Skip to content
  • Recent
  • Tags
  • Popular
  • Users
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse

Lay Theme Forum

  1. Home
  2. General Discussion
  3. Reactive/negative text – text reacting to the background

Reactive/negative text – text reacting to the background

Scheduled Pinned Locked Moved General Discussion
7 Posts 3 Posters 61 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    K_Rim
    wrote on last edited by
    #1

    Hey Everyone,

    I saw some websites using text that reacts to what is behind.
    Additional to that, i once also saw cursors doing that.

    Do you have any clue on how to achieve that effect?

    I'd like to implement it to my menu and some text.

    https://visual-space-agency.com/overview/

    https://leandrodisler.com/

    Thank you in advance :)

    Gross.jpeg

    Bildschirmfoto 2025-03-01 um 18.35.49.jpg

    1 Reply Last reply
    0
    • P Offline
      P Offline
      piotr
      wrote on last edited by
      #2

      Hi there

      I implemented it in my menu, have a look here:

      http://laythemeforum.com:4567/topic/10673/menu-text-color-change-when-overlapping-with-images

      Don't know how to do it to the cursor though

      1 Reply Last reply
      0
      • arminunruhA Offline
        arminunruhA Offline
        arminunruh
        Global Moderator
        wrote on last edited by
        #3

        Hey there, so what happens here is people use CSS called mixed blend mode difference, and the text has to be white for it to work.

        https://www.instagram.com/p/Cjm8eHkjiXA/

        I once did a reel about this that you can see here.

        1 Reply Last reply
        0
        • arminunruhA Offline
          arminunruhA Offline
          arminunruh
          Global Moderator
          wrote on last edited by arminunruh
          #4

          If people use cursors with this effect, then they are using an HTML element as a cursor. This HTML element is white and needs to use the mix-blend-mode effect too. It uses JavaScript to update its position.

          For example, if you go to ChatGPT and use this prompt:
          "Can you tell me the HTML code, the CSS code and the JavaScript code I need to have a cursor that uses Mix Blend Mode Difference? The cursor should be an HTML element that updates its position using JavaScript. "

          You will get a pretty good answer

          This is from that answer, and I'm just changing the answer a little to make it more applicable to Lay Theme. Go to Lay Theme Custom CSS and HTML. And then in HTML at the top insert:

          <div class="custom-cursor" id="customCursor"></div>
          

          In Custom CSS insert:

          body {
            cursor: none; /* Hide the default cursor */
          }
          /* Custom cursor styling */
          .custom-cursor {
            position: fixed;
            top: 0;
            left: 0;
            width: 20px;
            height: 20px;
            background-color: white;
            border-radius: 50%;
            pointer-events: none;
            mix-blend-mode: difference;
            transition: transform 0.05s ease-out;
            z-index: 9999;
          }
          

          In Custom HTML at Bottom, Insert:

          <script>
          const cursor = document.getElementById('customCursor');
          
          document.addEventListener('mousemove', (e) => {
            cursor.style.transform = `translate(${e.clientX - 10}px, ${e.clientY - 10}px)`;
          });
          </script>
          

          How it works:
          The default cursor is hidden (cursor: none).

          A white circular div follows the mouse.

          mix-blend-mode: difference causes the white cursor to invert the background color underneath it — this creates a dynamic effect against light or dark backgrounds.

          1 Reply Last reply
          0
          • arminunruhA Offline
            arminunruhA Offline
            arminunruh
            Global Moderator
            wrote on last edited by
            #5

            Screenshot 2025-05-12 at 10.16.05.png

            Here you can see the result.

            1 Reply Last reply
            0
            • arminunruhA Offline
              arminunruhA Offline
              arminunruh
              Global Moderator
              wrote on last edited by
              #6

              http://laythemeforum.com:4567/topic/6161/cursor-invert-color-black-white-text/19

              Actually, I already wrote a tutorial for this in the link above.

              1 Reply Last reply
              0
              • K Offline
                K Offline
                K_Rim
                wrote on last edited by
                #7

                @arminunruh Hey man,

                Thank you so much! It was a big help and everything works as intended :)

                Also thanks to @piotr for telling me about your topic :)

                Enjoy your weeks

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                I also code custom websites or custom Lay features.
                💿 Email me here: 💿
                info@laytheme.com

                Before you post:
                1. When using a WordPress Cache plugin, disable it or clear your cache.
                2. Update Lay Theme and all Lay Theme Addons
                3. Disable all Plugins
                4. Go to Lay Options → Custom CSS & HTML, click "Turn Off All Custom Code", click "Save Changes"

                This often solves issues you might run into

                When you post:
                1. Post a link to where the problem is
                2. Does the problem happen on Chrome, Firefox, Safari or iPhone or Android?
                3. If the problem is difficult to explain, post screenshots / link to a video to explain it
                Online Users
                Forgot your key, lost your files, need a previous Lay Theme or Addon version? Go to www.laykeymanager.com
                laytheme.com
                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Recent
                • Tags
                • Popular
                • Users
                • Search