colors.hsv: adding complimentary-color.

db4
John Benediktsson 2012-10-21 13:24:51 -07:00
parent 1d9a0f40fc
commit 659dbd0add
1 changed files with 9 additions and 0 deletions

View File

@ -55,3 +55,12 @@ M: hsva >rgba ( hsva -- rgba )
{ [ b x = r z > and ] [ 5 x r - x z - / - ] }
} cond 6 / 360 * x z - x / x a <hsva>
] if ;
: complimentary-color ( color -- color' )
dup hsva? [ >rgba rgba>hsva ] unless
{
[ hue>> 180 + 360 mod ]
[ saturation>> ]
[ value>> ]
[ alpha>> ]
} cleave <hsva> ;