Color Specifications


Several methods in various APIs allow a color to be specified, via 5 arguments, as follows:

The first argument denotes one of five possible color systems, via an enumeration value colorSysEnum, with possible values 1, 2, 3, 4 or 5, indicating


The next four arguments v1, v2, v3, and v4 are the intensities of the color channels defined by the choice of color system, as shown in the table below:

colorSysEnum v1 v2 v3 v4
1 - RGB red green blue ignored
2 - CMY cyan magenta yellow ignored
3 - CMYK cyan magenta yellow black
4 - HSV hue saturation value ignored
5 - HLS hue lightness saturation ignored

All intensities are between 0.0 and 1.0, inclusive, where 0.0 turns the channel off and 1.0 maximizes the channel intensity.  For those familiar with intensities as byte values between 0 and 255, the following examples should suffice to show the correspondence: