ryb>rgb ( r! y! b! -- r g b )


Vocabulary
colors.ryb.private

Inputs
r!an object
y!an object
b!an object


Outputs
ran object
gan object
ban object


Definition


:: ryb>rgb ( r! y! b! -- r g b )
r y b max max :> my y b min :> g! y g - y! b g - b! b g
[ 0 > ] both? [ b 2 * b! g 2 * g! ] when r y + r! g y +
g! r g b 3dup max max
[ my swap / [ * ] curry tri@ ] unless-zero ;