-
-
Notifications
You must be signed in to change notification settings - Fork 337
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(theme): check real colors to support css variables
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
- Loading branch information
Showing
13 changed files
with
376 additions
and
376 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.