Color.toListHSV

From MiniScript Wiki
Jump to navigation Jump to search

color.toListHSV converts a color in standard string form to a list of four numbers: hue, saturation, value, and alpha, all in the range 0-255.

See also: color.toListHSV

Arguments

Parameter Name Type Default Value Meaning
colorString string null string in standard HSV color form

Usage Notes

All methods and colors in the Mini Micro API, except this one, represent colors as hexadecimal strings, e.g. "#FF8080C8". However, sometimes it is convenient to represent a color as a list of numbers, so for example you can do math with them. In such cases, you can use color.toList to convert to list form, then later use color.fromListHSV to convert back into standard HSV color form.

Example

print color.toListHSV(color.brown)

The above prints [21, 170, 153, 255], representing the color brown. The hue value is 21, saturation is 170, value is 153, and the alpha value is 255 (fully opaque).