]> gitweb.factorcode.org Git - factor.git/commitdiff
colors.hsv: add a golden-rainbox color sequence word.
authorJohn Benediktsson <mrjbq7@gmail.com>
Wed, 3 Apr 2013 23:08:52 +0000 (16:08 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Wed, 3 Apr 2013 23:08:52 +0000 (16:08 -0700)
basis/colors/hsv/hsv.factor

index 47b3247e76b85011959a0022bb9d791d3ae9ac42..49552b3ac6eb9b25c1437eba5b7621f1177be12a 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2008 Eduardo Cavazos.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors arrays colors combinators kernel locals math
-math.functions sequences sorting ;
+math.functions random sequences sorting ;
 IN: colors.hsv
 
 ! h [0,360)
@@ -71,3 +71,8 @@ PRIVATE>
         [ value>> ]
         [ alpha>> ]
     } cleave <hsva> ;
+
+: golden-rainbow ( num-colors saturation luminance -- colors )
+    [ random-unit ] 3dip '[
+        0.618033988749895 + 1.0 mod dup _ _ 1.0 <hsva>
+    ] replicate nip ;