RGB to HSV Colours
Functions to convert colour definitions between RGB and HSV.

The Oasys JS API uses RGB colour definitions, where all colour is defined using Red Green Blue values that vary between 0 and 255. This allows for over 16 million colours but the RGB definition makes it difficult to vary colour in a natural way.
One alternative way to define colour is HSV: hue/saturation/value (also known as HSB: hue/saturation/brightness). With this definition it is possible to vary colours in more natural ways by increasing/decreasing one of the 3 values.
The functions included with this script are:
RGB2HSV(R,G,B)
– Inputs are R,G,B values which should be integer and be between 0 and 255.
– Output is an object with properties .h .s .v, corresponding to the equivalent HSV colour.
HSV2RGB(R,G,B)
– Inputs are H,S,V values which should be numeric and 0-360 for H, and 0-100 for S and V.
– Output is an object with properties .r .g .b, corresponding to the equivalent RGB colour (as integers between 0-255).
The script allows users to work with HSV colours before swapping to RGB for use with Colour.RGB( ) in the Oasys API.
The script comes with a _example file that shows how it works with a little GUI in PRIMER, D3PLOT or T-HIS.