Class “ColorResources”

Object > Resources > ColorResources

This is the base class for all color resource dictionaries. Instances can be obtained via the from method, or by subclassing. All members of a ColorResources (or subclass) instance will be of the type Color.

Type: ColorResources extends Resources<Color, ColorValue>
Constructor: protected
Singleton: No
Namespace: tabris
Direct subclasses: None
JSX Support: No

See also:

Resource Management in Tabris.js
Defining raw color resource data in a separate JSON file.
Converting raw color resource data to ColorResources instance.
TSX Using a ColorResources dictionary [► Run in Playground]

Static Methods

from(base, data)

Creates a colors dictionary from the given raw “data” object. All colors from the given “base” dictionary are inherited unless overwritten.

Entries in the “data” object starting with “$” are considered configuration options and will not become entries in the final colors dictionary.

Parameter Type Description
base Base A plain object or another ColorResources instance containing values to inherit by the new ColorResources dictionary.
data Data The raw data (plain object) to create the dictionary from. The format must match the Tabris.js colors JSON schema.

Returns: ColorResources

from(data)

Creates a colors dictionary from the given raw “data” object. The format must match the Tabris.js colors JSON schema. Entries in the “data” object starting with “$” are considered configuration options and will not become entries in the final colors dictionary.

Parameter Type Description
data Data The raw data (plain object) to create the dictionary from. The format must match the Tabris.js colors JSON schema.

Returns: ColorResources