UIDefaultsLoader: added contrast() color function (inspired by Less CSS), which is useful to choose a foreground color that is readable, based on the luma (perceptual brightness) of a background color

This commit is contained in:
Karl Tauber
2021-08-30 23:58:37 +02:00
parent 9b465cb550
commit 7f9cf6f45c
9 changed files with 180 additions and 18 deletions

View File

@@ -70,3 +70,32 @@ Prop.colorFunc42 = tint(#f0f,75%)
Prop.colorFunc45 = shade(#f0f,25%)
Prop.colorFunc46 = shade(#f0f)
Prop.colorFunc47 = shade(#f0f,75%)
Prop.colorFunc50 = contrast(#111,#000,#fff)
Prop.colorFunc51 = contrast(#eee,#000,#fff)
Prop.colorFunc52 = contrast(#111,$Prop.colorFunc1,$Prop.colorFunc3)
Prop.colorFunc53 = contrast(#eee,$Prop.colorFunc1,$Prop.colorFunc3)
Prop.colorFunc54 = contrast(lighten(#111,5%),$Prop.colorFunc1,$Prop.colorFunc3)
Prop.colorFunc55 = contrast(lighten(#eee,5%),$Prop.colorFunc1,$Prop.colorFunc3)
Prop.colorFunc56 = contrast(contrast(#222,#111,#eee),contrast(#eee,#000,#fff),contrast(#111,#000,#fff))
Prop.1.selectionBackground = #2675BF
Prop.1.selectionForeground = contrast($Prop.1.selectionBackground,#000,#fff)
Prop.2.selectionBackground = #95c0e9
Prop.2.selectionForeground = contrast($Prop.2.selectionBackground,#000,#fff)
Prop.3.selectionBackground = #f00
Prop.3.selectionForeground = contrast($Prop.3.selectionBackground,#000,#fff)
Prop.4.selectionBackground = #0f0
Prop.4.selectionForeground = contrast($Prop.4.selectionBackground,#000,#fff)
Prop.5.selectionBackground = #00f
Prop.5.selectionForeground = contrast($Prop.5.selectionBackground,#000,#fff)
Prop.6.selectionBackground = #FFCC00
Prop.6.selectionForeground = contrast($Prop.6.selectionBackground,#000,#fff)
Prop.7.selectionBackground = #FF9500
Prop.7.selectionForeground = contrast($Prop.7.selectionBackground,#000,#fff)