UIDefaultsLoader: added fadein(), fadeout(), fade() and spin() color functions (inspired by Less CSS)

This commit is contained in:
Karl Tauber
2020-11-19 11:31:38 +01:00
parent 8b8ed0b9ff
commit 0101171159
9 changed files with 135 additions and 20 deletions

View File

@@ -336,8 +336,9 @@ class FlatCompletionProvider
"lightness", "0-100%",
"alpha", "0-100%" );
String colorParamDesc = "a color (e.g. #f00), a reference (e.g. $Other.key) or a color function";
String[] hslIncreaseDecreaseParams = {
"color", "a color (e.g. #f00), a reference (e.g. $Other.key) or a color function",
"color", colorParamDesc,
"amount", "0-100%",
"options", "(optional) [relative] [autoInverse] [noAutoInverse] [lazy] [derived]"
};
@@ -345,6 +346,17 @@ class FlatCompletionProvider
addFunction( "darken", hslIncreaseDecreaseParams );
addFunction( "saturate", hslIncreaseDecreaseParams );
addFunction( "desaturate", hslIncreaseDecreaseParams );
addFunction( "fadein", hslIncreaseDecreaseParams );
addFunction( "fadeout", hslIncreaseDecreaseParams );
addFunction( "fade",
"color", colorParamDesc,
"amount", "0-100%",
"options", "(optional) [derived]" );
addFunction( "spin",
"color", colorParamDesc,
"angle", "number of degrees to rotate",
"options", "(optional) [derived]" );
}
private void addFunction( String name, String... paramNamesAndDescs ) {

View File

@@ -40,3 +40,12 @@ Prop.colorFunc5=lighten(#fe1289,20%)
Prop.colorFunc6=darken(#fe1289,20%)
Prop.colorFunc7=lighten($Prop.colorFunc4,20%,relative autoInverse)
Prop.colorFunc8=lighten(Prop.colorFunc4,20%,lazy)
Prop.colorFunc9=fadein(#ff000000,30%)
Prop.colorFunc10=fadeout(#ff0000,40%)
Prop.colorFunc11=fade(#ff0000,50%)
Prop.colorFunc12=#f00
Prop.colorFunc13=spin($Prop.colorFunc12,40)
Prop.colorFunc14=spin($Prop.colorFunc12,-40)
Prop.colorFunc15=spin($Prop.colorFunc12,400)
Prop.colorFunc16=spin($Prop.colorFunc12,-400)