diff options
author | Eduardo Julian | 2018-10-18 06:57:26 -0400 |
---|---|---|
committer | Eduardo Julian | 2018-10-18 06:57:26 -0400 |
commit | 422ca55b60bf029349476312f4bebf7709aea397 (patch) | |
tree | 20b14a1909ffdd12d559d450a43d01d6c2ea0f60 /stdlib/source | |
parent | a3d820cfb8c0b317d70b14edeeb00bbabb6fb030 (diff) |
- Added "Alpha" abstraction.
- Added "Pigment" abstraction.
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}) |