LESS and incidental number



  • Can. LESS generating an accidental number, so you can give it a random color?



  • Maybe. LESS May be implemented JavaScriptso you can generate random color:

    .randomColor(){
      @randomColor: `Math.floor(Math.random()*16777215).toString(16)`;
      @colorHex: e(@randomColor);
      @color: ~"#@{colorHex}";
    }
    

    body {
    .randomColor();
    background-color: @color;
    }

    https://gist.github.com/juanbrujo/7e4e17428dc8881d0e7e


Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2