使用Sass防止hsl变为十六进制颜色
为什么HSL颜色在使用Sass时变成十六进制格式使用Sass防止hsl变为十六进制颜色,sass,Sass,为什么HSL颜色在使用Sass时变成十六进制格式 .bgcolor{ background-color: hsl(205,74%,66%); /* background-color: #68b3e8; */ } 我发现了这个Sass,我意识到了两种防止这种转换发生的方法: 覆盖hsl Sass本机函数 @function hsl($h, $s, $l) { @return unquote('hsl(#{$h}, #{$s}, #{$l})'); } .bgcolor{ bac
.bgcolor{
background-color: hsl(205,74%,66%);
/* background-color: #68b3e8; */
}
我发现了这个Sass,我意识到了两种防止这种转换发生的方法:
@function hsl($h, $s, $l) {
@return unquote('hsl(#{$h}, #{$s}, #{$l})');
}
.bgcolor{
background-color: hsl(205,74%,66%);
}
#{}
插值将其字符串化
.bgcolor{
background-color: #{'hsl(205,74%,66%)'};
}