>hsva ( color -- hsva )


Vocabulary
colors.hsv

Inputs
coloran object


Outputs
hsvaan object


Definition

GENERIC: >hsva ( color -- hsva )


Methods







M:: rgba >hsva ( rgba -- hsva )
rgba >rgba-components :> ( r g b a ) r g b sort-triple
:> ( z y x ) x z = x zero? or
[ 0 0 x a <hsva> ] [
{
{ [ r x = g z = and ] [ 5 x b - x z - / + ] }
{ [ r x = g z > and ] [ 1 x g - x z - / - ] }
{ [ g x = b z = and ] [ 1 x r - x z - / + ] }
{ [ g x = b z > and ] [ 3 x b - x z - / - ] }
{ [ b x = r z = and ] [ 3 x g - x z - / + ] }
{ [ b x = r z > and ] [ 5 x r - x z - / - ] }
} cond 6 / 360 * x z - x / x a <hsva>
] if ;