等价于 iscolor 的 sass in less

Ale*_*eri 1 sass less

我想知道是否有一种方法可以模拟 sass/scss 中 less 中存在的 iscolor 函数。
我在文档中没有找到这个功能,但我希望有办法做到这一点。

我的入住少是这样的:

.myfunction(@color) when (iscolor(@color)){
    color:@color;
}
Run Code Online (Sandbox Code Playgroud)

蠢货

@mixin myfunction($color){
   //function to check if color is a real color
}
Run Code Online (Sandbox Code Playgroud)

cim*_*non 5

文档有丰富的信息(参见:http : //sass-lang.com/documentation/Sass/Script/Functions.html

@mixin myfunction($color){ // functions and mixins are very differen't things
    @if type-of($color) == color {
        @debug yep;
    }
}
Run Code Online (Sandbox Code Playgroud)