UIDefaultsLoader: added tint() and shade() color functions (inspired by Less CSS)

This commit is contained in:
Karl Tauber
2021-08-05 23:37:42 +02:00
parent 3f5acda132
commit 0544a605c3
4 changed files with 31 additions and 8 deletions

View File

@@ -371,10 +371,17 @@ class FlatCompletionProvider
addFunction( "changeLightness", hslChangeParams );
addFunction( "changeAlpha", hslChangeParams );
String weightParamDesc = "(optional) 0-100%, default is 50%";
addFunction( "mix",
"color1", colorParamDesc,
"color2", colorParamDesc,
"weight", "(optional) 0-100%, default is 50%" );
"weight", weightParamDesc );
addFunction( "tint",
"color", colorParamDesc,
"weight", weightParamDesc );
addFunction( "shade",
"color", colorParamDesc,
"weight", weightParamDesc );
}
private void addFunction( String name, String... paramNamesAndDescs ) {

View File

@@ -69,6 +69,8 @@ public class FlatThemeTokenMaker
tokenMap.put( "changeLightness", TOKEN_FUNCTION );
tokenMap.put( "changeAlpha", TOKEN_FUNCTION );
tokenMap.put( "mix", TOKEN_FUNCTION );
tokenMap.put( "tint", TOKEN_FUNCTION );
tokenMap.put( "shade", TOKEN_FUNCTION );
tokenMap.put( "lazy", TOKEN_FUNCTION );
// function options

View File

@@ -62,3 +62,11 @@ Prop.colorFunc33 = mix(#f00,#0f0,75%)
Prop.colorFunc34 = mix(#f00,#0f0,90%)
Prop.colorFunc35 = mix($Prop.color1,$Prop.color2)
Prop.colorFunc36 = mix($Prop.colorFunc20,$Prop.colorFunc30)
Prop.colorFunc40 = tint(#f0f,25%)
Prop.colorFunc41 = tint(#f0f)
Prop.colorFunc42 = tint(#f0f,75%)
Prop.colorFunc45 = shade(#f0f,25%)
Prop.colorFunc46 = shade(#f0f)
Prop.colorFunc47 = shade(#f0f,75%)