From MiniScript Wiki
Jump to navigation Jump to search

color.toList converts a color in standard string form to a list of four numbers: red, green, blue, and alpha, all in the range 0-255.

See also: color.fromList


Parameter Name Type Default Value Meaning
colorString string null string in standard 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.fromList to convert back into standard color form.


print color.toList(color.brown)

The above prints [153, 102, 51, 255], representing the color brown. The red value is 153, green is 102, blue is 51, and the alpha value is 255 (fully opaque).