Reputation: 103428
If I have:
.foo
{
background-color:#fff;
}
LESS converts this to:
.foo
{
background-color:white;
}
Why is this? Do browsers process named colours faster than HEX values?
I'm implementing LESS using dotless. Could this be carrying out the conversion? And if so why?
Upvotes: 8
Views: 722
Reputation: 89780
Color compression
In dotless we favour the color keyword over the hex code, if one matches. When compressing it chooses whichever is shorter.. e.g. #FFF, #FFFFFF, white then #FFF will be chosen, but in the case of red, the keyword red will be used.
In less.js every colour is replaced with a hex code.
The above quote is from the official Dotless GitHub page.
Notes:
DisableColorCompression
flag has already been added to disable this compression.DisableColorCompression
flag addresses the hex code to color name conversion item fully.Upvotes: 3