LESScss converting rgba to hex? how to nest color variables into a mixin?

后端 未结 3 1864
你的背包
你的背包 2021-01-31 05:00

Does LESScss convert all rgba colors to hex values?

I am trying to create a mixin, say, .color, that allows you to pass in a color variable previously defined, and I wan

3条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-31 05:57

    LESS has a set of functions to fade, fadeIn, or fadeOut a color. You should be able to pass any color to these mixins (hsl, rgb, rgba, hex, etc.)

    // fade color to 40%
    color: fade(#000000, 40);
    
    // fade in color by 10%
    color: fadeIn(rgba(0, 0, 0, .5), 10);
    
    // fade out color by 10%
    color: fadeOut(rgba(0, 0, 0, .5), 10);
    

提交回复
热议问题