diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/library/lux/data/color.lux | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/stdlib/source/library/lux/data/color.lux b/stdlib/source/library/lux/data/color.lux index 5e6f20eb6..68cf97171 100644 --- a/stdlib/source/library/lux/data/color.lux +++ b/stdlib/source/library/lux/data/color.lux @@ -284,7 +284,7 @@ #green (..up green) #blue (..up blue)})))) -(def: (normalize ratio) +(def: (normal ratio) (-> Frac Frac) (cond (f.> +1.0 ratio) (f.% +1.0 ratio) @@ -297,7 +297,7 @@ (def: #export (interpolate ratio end start) (-> Frac Color Color Color) - (let [dS (..normalize ratio) + (let [dS (..normal ratio) dE (|> +1.0 (f.- dS)) interpolate' (: (-> Nat Nat Nat) (function (_ end start) @@ -326,7 +326,7 @@ (let [[hue saturation luminance] (to_hsl color)] (of_hsl [hue (|> saturation - (f.* (|> +1.0 (<op> (..normalize ratio)))) + (f.* (|> +1.0 (<op> (..normal ratio)))) (f.min +1.0)) luminance])))] @@ -346,10 +346,10 @@ (-> Color [Color Color Color]) (let [[hue saturation luminance] (to_hsl color)] [color - (of_hsl [(|> hue (f.+ <1>) ..normalize) + (of_hsl [(|> hue (f.+ <1>) ..normal) saturation luminance]) - (of_hsl [(|> hue (f.+ <2>) ..normalize) + (of_hsl [(|> hue (f.+ <2>) ..normal) saturation luminance])]))] @@ -363,13 +363,13 @@ (-> Color [Color Color Color Color]) (let [[hue saturation luminance] (to_hsb color)] [color - (of_hsb [(|> hue (f.+ <1>) ..normalize) + (of_hsb [(|> hue (f.+ <1>) ..normal) saturation luminance]) - (of_hsb [(|> hue (f.+ <2>) ..normalize) + (of_hsb [(|> hue (f.+ <2>) ..normal) saturation luminance]) - (of_hsb [(|> hue (f.+ <3>) ..normalize) + (of_hsb [(|> hue (f.+ <3>) ..normal) saturation luminance])]))] @@ -386,9 +386,9 @@ (def: #export (analogous spread variations color) (-> Spread Nat Color (List Color)) (let [[hue saturation brightness] (to_hsb color) - spread (..normalize spread)] + spread (..normal spread)] (list\map (function (_ idx) - (of_hsb [(|> idx inc .int int.frac (f.* spread) (f.+ hue) ..normalize) + (of_hsb [(|> idx inc .int int.frac (f.* spread) (f.+ hue) ..normal) saturation brightness])) (list.indices variations)))) @@ -396,12 +396,12 @@ (def: #export (monochromatic spread variations color) (-> Spread Nat Color (List Color)) (let [[hue saturation brightness] (to_hsb color) - spread (..normalize spread)] + spread (..normal spread)] (|> (list.indices variations) (list\map (|>> inc .int int.frac (f.* spread) (f.+ brightness) - ..normalize + ..normal [hue saturation] of_hsb))))) |