[RUBY} H, S, V colours

Post any examples or modules that you want to share here
Post Reply
User avatar
trogluddite
Posts: 1730
Joined: Fri Oct 22, 2010 12:46 am
Location: Yorkshire, UK

[RUBY} H, S, V colours

Post by trogluddite »

Somehow always found HSV much more intuitive than RGB for defining colours - and it's nice that we have HSV primitives in the toolbox in FS.
Here's the equivalent for Ruby - two new methods that tag onto the Color class of objects.
Now, doing stuff to the stock classes is a bit naughty really, so I've tried to make them conform to the same standards for arguments and values as the stock methods (and primitives) - so if Malc (hint, hint) ever added these methods to the stock Ruby, they would hopefully just be drop in replacements.

Two new methods...

Color.newHSV(alpha, H, S, V) - create a new colour using HSV values. like the regular Color.new, you don't have to give all the arguments.
<color>.getAHSV - get an array of the HSV values for an existing Color object.

RGB and HSB.fsm
(documentation inside the download)
(126.86 KiB) Downloaded 1389 times

NB) There's already an undocumented method <color>.getARGB to find out the RGB values of a color object!
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
Dimmak01
Posts: 12
Joined: Mon Oct 19, 2009 11:38 am

Re: [RUBY} H, S, V colours

Post by Dimmak01 »

Thanks trogluddite! :ugeek:
Post Reply