Docs (4.0.0)
Themes and colors

class UIColor

An object that represents a single color value.

class UIColor

Description

Instances of UIColor can be used with style classes and overrides, as well as properties of various UI components, such as UICell.background. The toString() method simply evaluates a CSS-compatible color string as needed, requiring no further logic where colors are used.

UIColor instances can be created with a base color such as #000 or rgba(0, 0, 0, 0.5), or a color defined by the current theme (see UITheme). Afterwards, UIColor methods can be used to create derived colors — changing brightness, transparency, or mixing colors together.

A set of base colors corresponding to the default theme colors are available as static properties of ui.color(). Use these as a starting point wherever possible.

Example

// Different ways to create UIColor objects
new UIColor("#000")
new UIColor("#aabbcc")
new UIColor("rgb(0,0,0)")
new UIColor("rgb(0,0,0,0.5)")

new UIColor("Black") // theme color name
ui.color.BLACK // same as above, recommended

ui.color.GREEN.alpha(0.5)
ui.color.PRIMARY_BG.text()
ui.color.PRIMARY_BG.brighten(0.2).text()

Constructor

Static Members

Instance Members