colorTag
colorTag: (Color) -> string<col=rrggbb>.
Colour helpers for overlays and panels.
| Method | Returns | Description |
|---|---|---|
colorTag(Color) | string | <col=rrggbb>. |
prependColorTag(string, Color) | string | <col=rrggbb>str. |
wrapWithColorTag(string, Color) | string | <col=rrggbb>str</col>. |
toHexColor(Color) | string | #rrggbb. |
colorLerp(Color, Color, number) | Color | Each channel, alpha included, interpolated and rounded half up; a t that pushes a channel out of range is an error. |
colorToHexCode(Color) | string | rrggbb, lower case. |
colorToAlphaHexCode(Color) | string | aarrggbb, lower case. |
colorWithAlpha(Color, number) | Color | The same RGB with alpha, clamped to 0-255. |
isAlphaHex(string) | boolean | Whether hex is (#|0x)? and 7-8 hex digits. |
isHex(string) | boolean | Whether hex is (#|0x)? and 1-8 hex digits. |
constrainValue(number) | number | value clamped to 0-255. |
fromString(string) | Color? | string as an integer (#rrggbb, 0x..., decimal, octal) read as ARGB, or nil when it does not decode. |
fromHex(string) | Color? | Six digits or fewer opaque, more read as ARGB; nil when it does not decode. |
fromObject(any) | Color | A saturated, bright colour whose hue comes from a hash of the object: a string, integer or boolean; anything else raises. |
| Field | Type | Description |
|---|---|---|
MAX_RGB_VALUE | number | ColorUtil.MAX_RGB_VALUE: 255. |
MIN_RGB_VALUE | number | ColorUtil.MIN_RGB_VALUE: 0. |
CLOSING_COLOR_TAG | string | ColorUtil.CLOSING_COLOR_TAG: "</col>". |
colorTagcolorTag: (Color) -> string<col=rrggbb>.
prependColorTagprependColorTag: (string, Color) -> string<col=rrggbb>str.
wrapWithColorTagwrapWithColorTag: (string, Color) -> string<col=rrggbb>str</col>.
toHexColortoHexColor: (Color) -> string#rrggbb.
colorLerpcolorLerp: (Color, Color, number) -> ColorEach channel, alpha included, interpolated and rounded half up; a t that pushes a channel out of range is an error.
colorToHexCodecolorToHexCode: (Color) -> stringrrggbb, lower case.
colorToAlphaHexCodecolorToAlphaHexCode: (Color) -> stringaarrggbb, lower case.
colorWithAlphacolorWithAlpha: (Color, number) -> ColorThe same RGB with alpha, clamped to 0-255.
isAlphaHexisAlphaHex: (string) -> booleanWhether hex is (#|0x)? and 7-8 hex digits.
isHexisHex: (string) -> booleanWhether hex is (#|0x)? and 1-8 hex digits.
constrainValueconstrainValue: (number) -> numbervalue clamped to 0-255.
fromStringfromString: (string) -> Color?string as an integer (#rrggbb, 0x..., decimal, octal) read as ARGB, or nil when it does not decode.
fromHexfromHex: (string) -> Color?Six digits or fewer opaque, more read as ARGB; nil when it does not decode.
fromObjectfromObject: (any) -> ColorA saturated, bright colour whose hue comes from a hash of the object: a string, integer or boolean; anything else raises.