Define variable name with variable in LESS operation

后端 未结 2 1536
暗喜
暗喜 2020-12-20 09:28

Can someone please explain why this code doesn\'t work:

@red-1:#ff0000;
@red-2:#990000;
@blue-1:#000ff;
@blue-2:#00099;

.setTheme(@theme){
  @color-1:~\"@{@         


        
2条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-20 09:52

    You can also try the "color" function to convert a string to color

    @color: '#ccc';
    background: color(@color);
    

    But yes, it didn't work on multi variables like your case. Resulted in #NaNNaNNaN

提交回复
热议问题