From 482ea99628e37002dcb9a1dffdc4e507ac3734d5 Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Wed, 3 Apr 2013 16:08:52 -0700 Subject: [PATCH] colors.hsv: add a golden-rainbox color sequence word. --- basis/colors/hsv/hsv.factor | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/basis/colors/hsv/hsv.factor b/basis/colors/hsv/hsv.factor index 47b3247e76..49552b3ac6 100644 --- a/basis/colors/hsv/hsv.factor +++ b/basis/colors/hsv/hsv.factor @@ -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 ; + +: golden-rainbow ( num-colors saturation luminance -- colors ) + [ random-unit ] 3dip '[ + 0.618033988749895 + 1.0 mod dup _ _ 1.0 + ] replicate nip ;