使用 SASS 返回随机位置和颜色 [英] Returning a Random Position and Color With SASS
本文介绍了使用 SASS 返回随机位置和颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用 SASS 为阴影创建随机颜色和位置.到目前为止,我已经找到了帮助并使定位正常工作,但目前正在为随机颜色而苦苦挣扎.我的代码如下:
I'm trying to create a random color and position for drop shadows with SASS. So far I have found help and got the positioning working, but am currently struggling with the random color. My code is as follows:
@import compass
@function multiple-box-shadow ($n, $sc)
$value: '#{random(2000)}px #{random(2000)}px $sc'
@for $i from 2 through $n
$value: '#{$value} , #{random(2000)}px #{random(2000)}px $sc'
@return unquote($value)
@return unquote($sc)
$shadows-small: multiple-box-shadow(700, '#0000ff')
$shadows-medium: multiple-box-shadow(200, '#00ff00')
$shadows-big: multiple-box-shadow(100, '#ff0000')
推荐答案
您可以:
rgb(random(256)-1, random(256)-1, random(256)-1);
这篇关于使用 SASS 返回随机位置和颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文