较少未定义的方法错误 [英] less undefined method error
问题描述
我有以下较少的编译错误。
undefined_methodError:错误评估函数`darken`:Object#< Object>在/Users/anderskitson/Sites/mrskitson.ca/wp-content/themes/wordpress-bootstrap/library/less/variables.less:164:34中没有方法'toHSL'
163 @navbarBackground:.. /images/nav.png;
164 @navbarBorder:darken(@navbarBackground,12%);
165
(此操作是通过更改navbar.less触发的)
减少文件
@navbarBackground:../images/nav.png;
background:url({@ navbarBackground});
解决方案从精细手动:
darken
减少颜色的亮度绝对量。
参数: / p>
color
:彩色物件。
amount
:百分比0-100%。
c $ c> color
darken
函数想要一个颜色,但您的@navbarBackground
是背景图像的URL。您收到关于toHSL
的投诉,因为LESS正尝试将颜色转换为HSL格式,以使更暗的计算更容易。
我不知道有什么办法通过LESS变暗图像,你可能需要手动变暗图像,并根据需要在它们之间切换。
I have the following less compile error. My less is below not sure what is causing this.
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)
Less File
@navbarBackground: "../images/nav.png"; background: url("{@navbarBackground}");
解决方案From the 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
The
darken
function wants a color but your@navbarBackground
is a URL for a background image. You're getting a complaint abouttoHSL
because LESS is trying to convert the color to the HSL format to make the darkening computation easier.I don't know of any way to darken an image through LESS, you might need to manually darken the image and switch between them as needed.
这篇关于较少未定义的方法错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!