关键字参数
Stylus 支持关键字参数或“kwargs”。这些参数允许你通过关联的参数名称引用参数。
下面显示的示例在功能上是等效的。但是,我们可以将关键字参数放在列表中的任何位置。未加键的剩余参数将应用于尚未满足的参数。
body {
color: rgba(255, 200, 100, 0.5);
color: rgba(red: 255, green: 200, blue: 100, alpha: 0.5);
color: rgba(alpha: 0.5, blue: 100, red: 255, 200);
color: rgba(alpha: 0.5, blue: 100, 255, 200);
}
body {
color: rgba(255, 200, 100, 0.5);
color: rgba(red: 255, green: 200, blue: 100, alpha: 0.5);
color: rgba(alpha: 0.5, blue: 100, red: 255, 200);
color: rgba(alpha: 0.5, blue: 100, 255, 200);
}
生成
body {
color: rgba(255,200,100,0.5);
color: rgba(255,200,100,0.5);
color: rgba(255,200,100,0.5);
color: rgba(255,200,100,0.5);
}
body {
color: rgba(255,200,100,0.5);
color: rgba(255,200,100,0.5);
color: rgba(255,200,100,0.5);
color: rgba(255,200,100,0.5);
}
要查看函数或混合接受哪些参数,请使用 p()
函数
p(rgba)
p(rgba)
生成
inspect: rgba(red, green, blue, alpha)
inspect: rgba(red, green, blue, alpha)