use less function && css variable breaks => color2.toHSL
See original GitHub issue:root{
--baseColor:pink;
}
@base-color:var(--baseColor, red);
@body-color:shade(var(--baseColor));
body{
background:@body-color;
}
error:
@base-color:var(–baseColor, red);
@body-color:shade(@base-color, 15%);
^
Error evaluating function shade
: color2.toHSL is not a function
in /Users/weiyinpeng/Documents/personal-area/github/mvp/webpack-demo/src/a.less (line 6, column 12)
@ ./src/a.less 2:14-111
@ ./src/index.js
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Color Manipulation With CSS Variables and HSL - Code Salad
Break colors into three variables: hue, saturation, and lightness; Combine HSL ... Use the CSS calc function to manipulate HSL variables.
Read more >Use CSS variables for controlling colors (#301147) - GitLab
We can reimplement the color functions use CSS variables and calc, or define suffixed-alternate variables, or (most likely) some combination ...
Read more >Open up new possibilities with custom properties and HSL
Color manipulation with CSS Variables and hsl : ... look at how most people use colors in custom properties 01:35 - Removing the...
Read more >Sass Color Functions in CSS - Jim Nielsen's Blog
Sass Color Functions in CSS ... tldr; define your colors with individual hsl values using CSS variables, then compose your color declarations ...
Read more >Calculating Color: Dynamic Color Theming with Pure CSS
With the magic of CSS Custom Properties, HSL colors, and some calc() fun, you too can create custom theming with no dependencies. That...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
While I am not familiar with the less source code, it seems to me that less would have CSS variables available to it at compile time, whether we declare them ourselves (like shown in the example) or have less generate code beforehand, and that creating a new function
var
for less to resolve references would be the simplest way of solving this. Currently, if we want to create dynamic themes for our apps, we have to find really “creative” (i.e. very cumbersome) ways of getting them to work, when we shouldn’t have to because that’s what CSS variables are for. There might be reason to say otherwise, but it is much easier to create apps using web components and then packing everything up with some kind of build tool (e.g. Vue CLI) than to do things the way we did over 5 years ago.The
var
function, I would suspect, would work similar to how less property variables and less variables work, at least in regards to scope. I’d be willing to take a crack at it if someone can help me understand how the whole less code works. Would rather not have to spend weeks in trying to figure it out if you guys can take care of it within 24-48 hours.