How do I convert a hexadecimal color to rgba with the Less compiler?

前端 未结 4 552
温柔的废话
温柔的废话 2020-12-07 13:16

I have the following code:

@color : #d14836;

.stripes span {
    -webkit-background-size: 30px 30px;
    -moz-background-size: 30px 30px;
    background-siz         


        
4条回答
  •  失恋的感觉
    2020-12-07 14:22

    Actually, the Less language comes with an embedded function called fade. You pass a color object and the absolute opacity % (higher value means less transparent):

    fade(@color, 50%);   // Return @color with 50% opacity in rgba
    

提交回复
热议问题