UIDefaultsLoader: added if() function (inspired by Less CSS)

This commit is contained in:
Karl Tauber
2021-09-26 23:54:06 +02:00
parent 36d5747fbf
commit a4ea88f4be
4 changed files with 83 additions and 3 deletions

View File

@@ -29,6 +29,24 @@ Prop.true = true
Prop.var = @var1
Prop.ref = $Prop.string
Prop.ifNotNull = if(#000,#0f0,#dfd)
Prop.ifNull = if(null,#0f0,#dfd)
Prop.ifTrue = if(true,#0f0,#dfd)
Prop.ifFalse = if(false,#0f0,#dfd)
Prop.ifOne = if(1,#0f0,#dfd)
Prop.ifZero = if(0,#0f0,#dfd)
@varTrue = true
@varFalse = false
@varTrueValue = #0f0
@varFalseValue = #dfd
Prop.ifVarTrue = if(@varTrue,@varTrueValue,@varFalseValue)
Prop.ifVarFalse = if(@varFalse,@varTrueValue,@varFalseValue)
Prop.ifTrueColorFunc = if(true,lighten(#f00,20%),darken(#f00,20%))
Prop.ifFalseColorFunc = if(false,lighten(#f00,20%),darken(#f00,20%))
Prop.ifUndefinedVar = if(@undefinedVar,#0f0,#dfd)
Prop.ifUndefinedProp = if($undefinedProp,#0f0,#dfd)
Prop.ifColor = lighten(if(#000,#0f0,#dfd), 10%)
Prop.ifColorVar = lighten(if(@varTrue,@varTrueValue,@varFalseValue), 10%)
Prop.lazy = lazy(Prop.string)
Prop.colorFunc1 = rgb(12,34,56)