Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LESS & Bootstrap : error evaluating function `darken`: color.toHSL is not a function in file

Tags:

I am working with MobileAngularUI framework.

When gulp task build my app, with LESS source files overriding some Bootstrap variables, I get a strange error:

Error evaluating function `darken`: color.toHSL is not a function in file /Users/fabio/mobileangularui/bower_components/bootstrap/less/variables.less line no. 382

In my LESS file I'm overriding some variables like this for example:

@brand-primary: #FF9900;
@my-navbar-link-color: #3399CC;

@navbar-default-color: @brand-primary;
@navbar-default-link-color: @my-navbar-link-color;

What's the problem, why I get this error?

Thanks in advance!

like image 739
uf4b Avatar asked Aug 05 '16 11:08

uf4b


People also ask

What is LESS full form?

Less (which stands for Leaner Style Sheets) is a backwards-compatible language extension for CSS. This is the official documentation for Less, the language and Less.js, the JavaScript tool that converts your Less styles to CSS styles.

What is the function of LESS?

Less is the comparative form of the function word little and can be used in the following ways: as a determiner (before a noun): Eat less fat. Schools put less emphasis on being creative.

What is a LESS variable?

Less variables are defined with a symbol @ and the values are assigned in the variable with a colon ( : ). Variables are actually "constants" in that they can only be defined once.

How do you extend in LESS?

Extend is connected to a selector which looks similar to a pseudo class with selector as parameter. The &:extend(selector) syntax can be put inside the body of ruleset. Nested selectors are matched using the extend selector. By default, extend looks for the exact match between the selectors.


1 Answers

In variables.less, the @navbar-default-brand-color variable is used:

@navbar-default-brand-color: @navbar-default-link-color;
@navbar-default-brand-hover-color: darken(@navbar-default-brand-color, 10%);

The error you get is because the darken function (LESS native function) is not able to parse your @my-navbar-link-color, so check you have a valid color (in the snippet, it seems to be valid)

like image 129
Finrod Avatar answered Sep 24 '22 16:09

Finrod