我有以下较少的编译错误。我的 less 在下面,不确定是什么原因造成的。
undefined_methodError: error evaluating function `darken`: Object #<Object> has no method 'toHSL' in /Users/anderskitson/Sites/mrskitson.ca/wp-content/themes/wordpress-bootstrap/library/less/variables.less:164:34
163 @navbarBackground: "../images/nav.png";
164 @navbarBorder: darken(@navbarBackground, 12%);
165
(This action was triggered by a change to navbar.less)
更少的文件
@navbarBackground: "../images/nav.png";
background: url("{@navbarBackground}");
最佳答案
来自fine manual :
darken
Decrease the lightness of a color by an absolute amount.
Parameters:
color
: A color object.amount
: A percentage 0-100%.Returns:
color
darken
函数需要颜色,但您的 @navbarBackground
是背景图片的 URL。您收到有关 toHSL
的投诉,因为 LESS 正在尝试将颜色转换为 HSL 格式以使变暗计算更容易。
我不知道有什么方法可以通过 LESS 使图像变暗,您可能需要手动使图像变暗并根据需要在它们之间切换。
关于css - 更少的未定义方法错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14300298/