-
-
Notifications
You must be signed in to change notification settings - Fork 107
Description
Hi, I'd like to propose a small sass code change (which I could implement myself if you agree), please find the rationale and suggestion below.
Use case description
I'm trying to use css variables for dynamic theme switching. To make it possible, I'd like to override materialize sass variables, e.g.:
$secondary-color: var(--secondary-color);
$secondary-color-lighten-4: var(--secondary-color-lighten-4);
$button-background-focus: var(--secondary-color-lighten-1);
These are my custom variables and they are taking precedence over materializecss variables. This works perfectly fine for me.
The problem
However, I cannot use color(var(--secondary-color))
, because I'd like --secondary-color
to be kept as it is, without preprocessing. I.e. in the output css I'd like to have smth like:
.button {
background-color: var(--secondary-color);
}
But without color(...)
, there is a problem with other variables and styles, since color functions are not working:
$primary-color-light: lighten($primary-color, 15%) !default;
.progress {
background-color: lighten($progress-bar-color, 40%);
}
This lighten
function fails, since it expects a color as input
For variables, this is not a problem, since I can easily override them
However, for css styles, I wasn't able to find a way, how to make it compilable.
Suggestion
What do you think about avoiding color functions in style files and to move all of them into variables?
For the example above, with the progress bar, it would look like:
$progress-bar-panel-color: lighten($progress-bar-color, 40%) default!;
.progress {
background-color: $progress-bar-panel-color;
}
I quickly checked the code, and usually there 1-2 color functions in sass files, so this shouldn't be a big change.
What do you think?