diff options
Diffstat (limited to 'stdlib/source')
-rw-r--r-- | stdlib/source/lux/data/color.lux | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/stdlib/source/lux/data/color.lux b/stdlib/source/lux/data/color.lux index 55624f29e..c242a48ad 100644 --- a/stdlib/source/lux/data/color.lux +++ b/stdlib/source/lux/data/color.lux @@ -1,7 +1,9 @@ (.module: [lux #* - [control ["eq" equivalence]] + [control + ["eq" equivalence]] [data + [number ("rev/." Interval<Rev>)] [collection ["." list ("list/." Functor<List>)]]] ["." math] @@ -28,9 +30,9 @@ (def: #export (color [red green blue]) (-> [Nat Nat Nat] Color) - (:abstraction [(n/% rgb red) - (n/% rgb green) - (n/% rgb blue)])) + (:abstraction {#red (n/% rgb red) + #green (n/% rgb green) + #blue (n/% rgb blue)})) (def: #export to-rgb (-> Color [Nat Nat Nat]) @@ -216,8 +218,8 @@ (interpolate' greenE greenS) (interpolate' blueE blueS)]))) -(def: black Color (color [0 0 0])) -(def: white Color (color [top top top])) +(def: #export black Color (color [0 0 0])) +(def: #export white Color (color [top top top])) (do-template [<name> <target>] [(def: #export (<name> ratio color) @@ -306,3 +308,21 @@ normalize [hue saturation] from-hsb)))))) + +(type: #export Alpha Rev) + +(def: #export transparent + Alpha + rev/bottom) + +(def: #export translucent + Alpha + .5) + +(def: #export opaque + Alpha + rev/top) + +(type: #export Pigment + {#color Color + #alpha Alpha}) |