-
-
Notifications
You must be signed in to change notification settings - Fork 338
fix(button,table): move LESS functions out of LESS file and into variables #737
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(button,table): move LESS functions out of LESS file and into variables #737
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
that solved the table, next one is Item:
|
No, this time the LESS function is part of a *.variable file (as all the other variables in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This change allows to use CSS variables in custom themes for LESS variables which are basically used in color functions. Although the themes changed variables are imported after the default theme, the LESS logic still tried to apply a css variable to a color function like "darken()" which of course does not work. It makes #737 complete now. So this simple order results into "error evaluating darken()", although the variables are immediatly overridden: @linkColor : #4183C4; @linkHoverColor : darken(saturate(@linkColor, 20), 15, relative); @linkColor: var(--some-link-color); @linkHoverColor: var(--some-link-hover-color); .foo { bar: @linkHoverColor; } By changing every existing color function call inside the default theme to check for a valid color value it is now possible to completely use CSS variables for a custom theme @linkColor : #4183C4; @linkHoverColor : if(iscolor(@linkColor), darken(saturate(@linkColor, 20), 15, relative), @linkColor); @linkColor: var(--some-link-color); @linkHoverColor: var(--some-link-hover-color); .foo { bar: @linkHoverColor; } Succesfully results into .foo { bar: var(--some-link-hover-color); } Simply check the above code via lesscss.org/less-preview The minium LESS Version to support this is 3.12.0, so i had to raise the dependency 3.x version
Description
The
button.less
andtable.less
files had hardcoded LESS color math functions included (darken/lighten/saturate/desaturate/screen).If somebody defines some color variables as CSS Variable strings ( like
var(--mycssvar)
) , any LESS Math functions did not work anymore and caused a LESS compiler error (because LESS always expects a valid color definition as argument)To comply with the central color definition system we invented in 2.7.0 this PR now replaces all those functions by appropriate variables instead.
This way, if someone decides to change all/some color definitions to strings like mentioned above, the button code won't break anymore (as long as every color related saturate/darken/lighten/desaturate...etc. was adjusted in the *.variables files)
Closes
#736