diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/test/lux/data/color.lux | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/stdlib/source/test/lux/data/color.lux b/stdlib/source/test/lux/data/color.lux index 81c45a8e2..990eb6aea 100644 --- a/stdlib/source/test/lux/data/color.lux +++ b/stdlib/source/test/lux/data/color.lux @@ -48,8 +48,8 @@ (def: (distance/3 from to) (-> /.Color /.Color Frac) - (let [[fr fg fb] (/.to_rgb from) - [tr tg tb] (/.to_rgb to)] + (let [[fr fg fb] (/.rgb from) + [tr tg tb] (/.rgb to)] (square_root ($_ f.+ (|> (scale tr) (f.- (scale fr)) square) @@ -61,7 +61,7 @@ (template [<field>] [(def: (<field> color) (-> /.Color Frac) - (let [[hue saturation luminance] (/.to_hsl color)] + (let [[hue saturation luminance] (/.hsl color)] <field>))] [saturation] @@ -71,19 +71,19 @@ (def: (encoding expected) (-> /.Color Test) ($_ _.and - (_.cover [/.RGB /.to_rgb /.of_rgb] - (|> expected /.to_rgb /.of_rgb + (_.cover [/.RGB /.rgb /.of_rgb] + (|> expected /.rgb /.of_rgb (\ /.equivalence = expected))) - (_.cover [/.HSL /.to_hsl /.of_hsl] - (|> expected /.to_hsl /.of_hsl + (_.cover [/.HSL /.hsl /.of_hsl] + (|> expected /.hsl /.of_hsl (distance/3 expected) (f.<= ..rgb_error_margin))) - (_.cover [/.HSB /.to_hsb /.of_hsb] - (|> expected /.to_hsb /.of_hsb + (_.cover [/.HSB /.hsb /.of_hsb] + (|> expected /.hsb /.of_hsb (distance/3 expected) (f.<= ..rgb_error_margin))) - (_.cover [/.CMYK /.to_cmyk /.of_cmyk] - (|> expected /.to_cmyk /.of_cmyk + (_.cover [/.CMYK /.cmyk /.of_cmyk] + (|> expected /.cmyk /.of_cmyk (distance/3 expected) (f.<= ..rgb_error_margin))) )) @@ -133,9 +133,9 @@ (do {! random.monad} [eH (\ ! map (|>> f.abs (f.% +0.9) (f.+ +0.05)) random.safe_frac) - #let [eS +0.5] + .let [eS +0.5] variations (\ ! map (|>> (n.% 3) (n.+ 2)) random.nat) - #let [max_spread (f./ (|> variations inc .int int.frac) + .let [max_spread (f./ (|> variations inc .int int.frac) +1.0) min_spread (f./ +2.0 max_spread) spread_space (f.- min_spread max_spread)] |