UIColor

class UIColor

Represents a single color (read-only).

Constructor

(colorName?: string): UIColor

.toString()

(): string

Return a CSS-compatible string representation.

.text()

(): UIColor

Return a new UIColor instance for a contrasting text color.

.alpha()

(alpha: number): UIColor

Return a new UIColor instance with given alpha value (0-1) applied, for higher transparency.

.lum()

(lum: number, contrast?: boolean): UIColor

Return a new UIColor instance with given luminosity value (between -1 and 1) applied, for darker or lighter colors; set contrast parameter to true to invert the scale for dark colors (i.e. move closer to/away from mid-grey instead of strictly lower and higher luminosity).