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. Need Custom Coding for Lay Theme? Find 3rd Party Developers here.
  3. Cursor invert color (black/white text)

Cursor invert color (black/white text)

Scheduled Pinned Locked Moved Need Custom Coding for Lay Theme? Find 3rd Party Developers here.
20 Posts 8 Posters 2.1k 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.
  • R Offline
    R Offline
    Richard
    Global Moderator
    wrote on Nov 17, 2020, 10:36 PM last edited by
    #4

    Dear @chloe543268

    There are ways to 'invert' colours on hover:

    https://davidwalsh.name/invert-colors-css

    https://davidwalsh.name/demo/invert-colors-css.php

    Is that what your were after when you referred to it being an image? :)

    Best
    Richard

    1 Reply Last reply
    0
    • C Offline
      C Offline
      chloe543268
      wrote on Nov 23, 2020, 9:59 AM last edited by
      #5

      Hi Richard, yes exactly ! But the color inversion must be done only inside the cursor shape (a circle). As in this example : https://centralstudio.ch/

      If you can help me to do it (if it's not too complicated) it would be amazing!
      Thank you

      1 Reply Last reply
      0
      • R Offline
        R Offline
        Richard
        Global Moderator
        wrote on Nov 27, 2020, 11:59 PM last edited by Richard Nov 27, 2020, 7:00 PM
        #6

        Dear @chloe543268

        Happy to help.
        This was fun to look into, its a nice trick they have done :)

        So its actually not a Cursor in the general sense - its an element ( box ) that moves in place of the cursor:

        You will need to add the following code into 'Lay -Options - Custom CSS & HTML'

        At the top of the page in 'Custom CSS':

        .pointer {
            cursor: none;
            background-color: #fff;
            position: fixed;
            text-align: center;
            width: 52px;
            height: 52px;
            z-index: 1000;
            transform: translate(-50%, -50%);
            pointer-events: none;
            mix-blend-mode: difference;
            overflow: hidden;
            border-radius: 50%;
        }
        

        NOTE: this 'background-color: #fff;' will be your starting colour so if your webpage has a black background you will see it but with a white background it will blend in. - you can change it to suit your needs

        Secondly in the ' Custom <head> content' add the following:

        <script>
        window.laytheme.on("newpageshown", function(layoutObj, type, obj){
            
          jQuery("body").append('<div class="pointer"></div>');
            jQuery("body").on("mousemove", function(e) {
        	jQuery(".pointer").css({ top: e.clientY + "px", left: e.clientX + "px" });
        	
        });
        
          });
        </script>
        

        Remember to save at the bottom of the page and then have a look at your Webpage.

        Its a cool effect, hope this helps and have a wonderful day. Let me know how you go! :)

        Best
        Richard

        X A 3 Replies Last reply Dec 17, 2020, 4:33 PM
        1
        • R Richard
          Nov 27, 2020, 11:59 PM

          Dear @chloe543268

          Happy to help.
          This was fun to look into, its a nice trick they have done :)

          So its actually not a Cursor in the general sense - its an element ( box ) that moves in place of the cursor:

          You will need to add the following code into 'Lay -Options - Custom CSS & HTML'

          At the top of the page in 'Custom CSS':

          .pointer {
              cursor: none;
              background-color: #fff;
              position: fixed;
              text-align: center;
              width: 52px;
              height: 52px;
              z-index: 1000;
              transform: translate(-50%, -50%);
              pointer-events: none;
              mix-blend-mode: difference;
              overflow: hidden;
              border-radius: 50%;
          }
          

          NOTE: this 'background-color: #fff;' will be your starting colour so if your webpage has a black background you will see it but with a white background it will blend in. - you can change it to suit your needs

          Secondly in the ' Custom <head> content' add the following:

          <script>
          window.laytheme.on("newpageshown", function(layoutObj, type, obj){
              
            jQuery("body").append('<div class="pointer"></div>');
              jQuery("body").on("mousemove", function(e) {
          	jQuery(".pointer").css({ top: e.clientY + "px", left: e.clientX + "px" });
          	
          });
          
            });
          </script>
          

          Remember to save at the bottom of the page and then have a look at your Webpage.

          Its a cool effect, hope this helps and have a wonderful day. Let me know how you go! :)

          Best
          Richard

          X Offline
          X Offline
          XLD
          wrote on Dec 17, 2020, 4:33 PM last edited by
          #7
          This post is deleted!
          1 Reply Last reply
          0
          • R Richard
            Nov 27, 2020, 11:59 PM

            Dear @chloe543268

            Happy to help.
            This was fun to look into, its a nice trick they have done :)

            So its actually not a Cursor in the general sense - its an element ( box ) that moves in place of the cursor:

            You will need to add the following code into 'Lay -Options - Custom CSS & HTML'

            At the top of the page in 'Custom CSS':

            .pointer {
                cursor: none;
                background-color: #fff;
                position: fixed;
                text-align: center;
                width: 52px;
                height: 52px;
                z-index: 1000;
                transform: translate(-50%, -50%);
                pointer-events: none;
                mix-blend-mode: difference;
                overflow: hidden;
                border-radius: 50%;
            }
            

            NOTE: this 'background-color: #fff;' will be your starting colour so if your webpage has a black background you will see it but with a white background it will blend in. - you can change it to suit your needs

            Secondly in the ' Custom <head> content' add the following:

            <script>
            window.laytheme.on("newpageshown", function(layoutObj, type, obj){
                
              jQuery("body").append('<div class="pointer"></div>');
                jQuery("body").on("mousemove", function(e) {
            	jQuery(".pointer").css({ top: e.clientY + "px", left: e.clientX + "px" });
            	
            });
            
              });
            </script>
            

            Remember to save at the bottom of the page and then have a look at your Webpage.

            Its a cool effect, hope this helps and have a wonderful day. Let me know how you go! :)

            Best
            Richard

            X Offline
            X Offline
            XLD
            wrote on Dec 17, 2020, 4:37 PM last edited by
            #8

            Re: Cursor invert color (black/white text)

            Dear @Richard-Keith

            I love this – thank you so much…

            Two things:

            (01)
            The cursor (element box) blends in perfectly on a white background page. But when I navigate to a black background page, the mix-blend-mode only works after a manual browser refresh.

            Can you help?

            (02)
            The default "arrow cursor" is still visible above the new custom cursor. Any idea why?

            Many thanks in advance!

            L 1 Reply Last reply May 21, 2024, 12:10 PM
            0
            • R Offline
              R Offline
              Richard
              Global Moderator
              wrote on Dec 19, 2020, 1:51 AM last edited by
              #9

              Hey :) @XLD

              Could you post a link to your website? :)

              If the question is in regards to when the cursor hits the edge of the browser and reverts back to standard - that is not a Lay Theme issue - this is a browser thing that is out of my hands :(

              Best
              Richard

              1 Reply Last reply
              0
              • E Offline
                E Offline
                evey_k
                wrote on Feb 3, 2021, 6:08 PM last edited by
                #10
                This post is deleted!
                1 Reply Last reply
                0
                • E Offline
                  E Offline
                  evey_k
                  wrote on Feb 3, 2021, 7:59 PM last edited by evey_k Feb 3, 2021, 3:08 PM
                  #11
                  This post is deleted!
                  1 Reply Last reply
                  0
                  • R Richard
                    Nov 27, 2020, 11:59 PM

                    Dear @chloe543268

                    Happy to help.
                    This was fun to look into, its a nice trick they have done :)

                    So its actually not a Cursor in the general sense - its an element ( box ) that moves in place of the cursor:

                    You will need to add the following code into 'Lay -Options - Custom CSS & HTML'

                    At the top of the page in 'Custom CSS':

                    .pointer {
                        cursor: none;
                        background-color: #fff;
                        position: fixed;
                        text-align: center;
                        width: 52px;
                        height: 52px;
                        z-index: 1000;
                        transform: translate(-50%, -50%);
                        pointer-events: none;
                        mix-blend-mode: difference;
                        overflow: hidden;
                        border-radius: 50%;
                    }
                    

                    NOTE: this 'background-color: #fff;' will be your starting colour so if your webpage has a black background you will see it but with a white background it will blend in. - you can change it to suit your needs

                    Secondly in the ' Custom <head> content' add the following:

                    <script>
                    window.laytheme.on("newpageshown", function(layoutObj, type, obj){
                        
                      jQuery("body").append('<div class="pointer"></div>');
                        jQuery("body").on("mousemove", function(e) {
                    	jQuery(".pointer").css({ top: e.clientY + "px", left: e.clientX + "px" });
                    	
                    });
                    
                      });
                    </script>
                    

                    Remember to save at the bottom of the page and then have a look at your Webpage.

                    Its a cool effect, hope this helps and have a wonderful day. Let me know how you go! :)

                    Best
                    Richard

                    A Offline
                    A Offline
                    alberto_califano
                    wrote on Mar 1, 2024, 10:41 AM last edited by
                    #12

                    @Richard Hello, I wanted to have a cursor with mix blend mode and I was able to do it by using the code written here.

                    The only problem is that when I go from a page to another it stop to work, and the cursor become invisible.

                    Does anyone have any ideas on why that happen?

                    Many thanks,
                    Alberto

                    1 Reply Last reply
                    0
                    • arminunruhA Offline
                      arminunruhA Offline
                      arminunruh
                      Global Moderator
                      wrote on Mar 3, 2024, 9:32 AM last edited by
                      #13

                      yea this code:

                      <script>
                      window.laytheme.on("newpageshown", function(layoutObj, type, obj){
                          
                        jQuery("body").append('<div class="pointer"></div>');
                          jQuery("body").on("mousemove", function(e) {
                      	jQuery(".pointer").css({ top: e.clientY + "px", left: e.clientX + "px" });
                      });
                      
                        });
                      </script>
                      

                      its wrong, because it adds a new pointer div everytime you go to a new page ^^

                      just do it like this instead:

                      jQuery(document).ready(function(){
                          jQuery("body").append('<div class="pointer"></div>');
                          jQuery("body").on("mousemove", function(e) {
                            jQuery(".pointer").css({ top: e.clientY + "px", left: e.clientX + "px" });
                          });
                      })
                      
                      A 1 Reply Last reply Mar 4, 2024, 12:07 PM
                      0
                      • arminunruhA arminunruh
                        Mar 3, 2024, 9:32 AM

                        yea this code:

                        <script>
                        window.laytheme.on("newpageshown", function(layoutObj, type, obj){
                            
                          jQuery("body").append('<div class="pointer"></div>');
                            jQuery("body").on("mousemove", function(e) {
                        	jQuery(".pointer").css({ top: e.clientY + "px", left: e.clientX + "px" });
                        });
                        
                          });
                        </script>
                        

                        its wrong, because it adds a new pointer div everytime you go to a new page ^^

                        just do it like this instead:

                        jQuery(document).ready(function(){
                            jQuery("body").append('<div class="pointer"></div>');
                            jQuery("body").on("mousemove", function(e) {
                              jQuery(".pointer").css({ top: e.clientY + "px", left: e.clientX + "px" });
                            });
                        })
                        
                        A Offline
                        A Offline
                        alberto_califano
                        wrote on Mar 4, 2024, 12:07 PM last edited by
                        #14

                        @arminunruh Thank you so much! It works perfectly now.

                        1 Reply Last reply
                        0
                        • X XLD
                          Dec 17, 2020, 4:37 PM

                          Re: Cursor invert color (black/white text)

                          Dear @Richard-Keith

                          I love this – thank you so much…

                          Two things:

                          (01)
                          The cursor (element box) blends in perfectly on a white background page. But when I navigate to a black background page, the mix-blend-mode only works after a manual browser refresh.

                          Can you help?

                          (02)
                          The default "arrow cursor" is still visible above the new custom cursor. Any idea why?

                          Many thanks in advance!

                          L Offline
                          L Offline
                          LenaW
                          wrote on May 21, 2024, 12:10 PM last edited by
                          #15

                          @XLD @Richard thanks for having this function explained, I bump into the same thing of also having the default "arrow cursor" still visible. How did you did you solve this in the end?
                          Many Thanks!
                          https://lenawinterink.com/category/test-work-category/

                          1 Reply Last reply
                          0
                          • arminunruhA Offline
                            arminunruhA Offline
                            arminunruh
                            Global Moderator
                            wrote on May 21, 2024, 1:27 PM last edited by
                            #16
                            *, a{
                            cursor: none!important
                            }
                            

                            https://developer.mozilla.org/en-US/docs/Web/CSS/cursor

                            maybe this

                            1 Reply Last reply
                            0
                            • arminunruhA Offline
                              arminunruhA Offline
                              arminunruh
                              Global Moderator
                              wrote on May 21, 2024, 1:28 PM last edited by
                              #17

                              ur website runs so fast wow even here in brazil. which webhost did you get or which caching plugin do you use?

                              1 Reply Last reply
                              0
                              • K Offline
                                K Offline
                                KW1
                                wrote on Feb 18, 2025, 5:29 PM last edited by
                                #18

                                Thank you for this topic and the explanations. One question: How do I manage to use the same effect, but use a customized .svg as shape? I'm stuck at the moment...

                                1 Reply Last reply
                                0
                                • arminunruhA Offline
                                  arminunruhA Offline
                                  arminunruh
                                  Global Moderator
                                  wrote on Feb 19, 2025, 7:45 AM last edited by
                                  #19

                                  Ok so first off, if anyone just wants a inverted cursor, i think this should be the correct code:

                                  In "Custom CSS":

                                  *{
                                      cursor: none!important;
                                  }
                                  .pointer {
                                      cursor: none;
                                      background-color: #fff;
                                      position: fixed;
                                      text-align: center;
                                      width: 52px;
                                      height: 52px;
                                      z-index: 1000;
                                      transform: translate(-50%, -50%);
                                      pointer-events: none;
                                      mix-blend-mode: difference;
                                      overflow: hidden;
                                      border-radius: 50%;
                                  }
                                  

                                  in HTML at bottom:

                                  <script>
                                  jQuery("body").append('<div class="pointer"></div>');
                                  jQuery("body").on("mousemove", function(e) {
                                  	jQuery(".pointer").css({ top: e.clientY + "px", left: e.clientX + "px" });
                                  });
                                  </script>
                                  

                                  previous code was using newpageshown to add the pointer div, but then it means it adds a new one every time you navigate on the page, thats not needed

                                  1 Reply Last reply
                                  0
                                  • arminunruhA Offline
                                    arminunruhA Offline
                                    arminunruh
                                    Global Moderator
                                    wrote on Feb 19, 2025, 8:11 AM last edited by
                                    #20

                                    to use a svg image, use https://developer.mozilla.org/en-US/docs/Web/CSS/background-image

                                    in HTML at bottom:

                                    <script>
                                    jQuery("body").append('<div class="pointer"></div>');
                                    jQuery("body").on("mousemove", function(e) {
                                    	jQuery(".pointer").css({ top: e.clientY + "px", left: e.clientX + "px" });
                                    });
                                    </script>
                                    

                                    In "Custom CSS":

                                    *{
                                        cursor: none!important;
                                    }
                                    .pointer {
                                        cursor: none;
                                        position: fixed;
                                        text-align: center;
                                        width: 52px;
                                        height: 52px;
                                        z-index: 1000;
                                        transform: translate(-50%, -50%);
                                        pointer-events: none;
                                        mix-blend-mode: difference;
                                        overflow: hidden;
                                        border-radius: 50%;
                                        background-image: url("http://localhost:10020/wp-content/uploads/2024/09/close-button.svg");
                                        background-position: center;
                                        background-repeat: no-repeat;
                                    }
                                    

                                    this is the part u change:
                                    background-image: url("http://localhost:10020/wp-content/uploads/2024/09/close-button.svg");

                                    get the url from wp-admin media library, when u click on an image u get File URL:

                                    Screenshot 2025-02-19 at 09.05.14.png

                                    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
                                    A
                                    alasdair17
                                    4 minutes ago
                                    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