Color.fromList

From MiniScript Wiki
Revision as of 03:29, 11 July 2021 by JoeStrout (talk | contribs) (Created page with "<c>color.fromList</c> converts a color in RGB list form — red, green, blue, and optional alpha, all in the range 0-255 — to a string in standard color form. See also:...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

color.fromList converts a color in RGB list form — red, green, blue, and optional alpha, all in the range 0-255 — to a string in standard color form.

See also: color.toList

Arguments

Parameter Name Type Default Value Meaning
rgbaList list null list of the form [red, green, blue] or [red, green, blue, alpha]

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. Then, use color.fromList to convert this list back into standard color form.

Example

print color.fromList([255, 128, 0, 200])

The above prints #FF8000C8.