| title | Color |
|---|---|
| titleTemplate | title - API / NativeScript |
| description | Represents a color object. Stores all color components (alpha (opacity), red, green, blue) in a [0..255] range. |
| contributors | false |
Defined in: color/index.d.ts:4
Represents a color object. Stores all color components (alpha (opacity), red, green, blue) in a [0..255] range.
new Color(knownColor: string): Color;Defined in: color/index.d.ts:5
| Parameter | Type |
|---|---|
knownColor |
string |
Color
new Color(hex: string): Color;Defined in: color/index.d.ts:6
| Parameter | Type |
|---|---|
hex |
string |
Color
new Color(argb: number): Color;Defined in: color/index.d.ts:7
| Parameter | Type |
|---|---|
argb |
number |
Color
new Color(
alpha: number,
red: number,
green: number,
blue: number,
type?: "rgb" | "hsl" | "hsv"): Color;Defined in: color/index.d.ts:8
| Parameter | Type |
|---|---|
alpha |
number |
red |
number |
green |
number |
blue |
number |
type? |
"rgb" | "hsl" | "hsv" |
Color
a: number;Defined in: color/index.d.ts:13
Gets the Alpha component (in the [0, 255] range) of this color. This is a read-only property.
android: number;Defined in: color/index.d.ts:48
Gets the android-specific integer value representation. Same as the Argb one. This is a read-only property.
argb: number;Defined in: color/index.d.ts:38
Gets the Argb Number representation of this color where each 8 bits represent a single color component. This is a read-only property.
b: number;Defined in: color/index.d.ts:28
Gets the Blue component (in the [0, 255] range) of this color. This is a read-only property.
g: number;Defined in: color/index.d.ts:23
Gets the Green component (in the [0, 255] range) of this color. This is a read-only property.
hex: string;Defined in: color/index.d.ts:33
Gets the Hexadecimal string representation of this color. This is a read-only property.
ios: any;Defined in: color/index.d.ts:53
Gets the iOS-specific UIColor value representation. This is a read-only property.
name: string;Defined in: color/index.d.ts:43
Gets the known name of this instance. Defined only if it has been constructed from a known color name - e.g. "red". This is a read-only property.
r: number;Defined in: color/index.d.ts:18
Gets the Red component (in the [0, 255] range) of this color. This is a read-only property.
brighten(amount: number): Color;Defined in: color/index.d.ts:172
Brighten the color a given amount, from 0 to 100.
| Parameter | Type | Description |
|---|---|---|
amount |
number |
(between 0 and 100) |
Color
complement(): Color;Defined in: color/index.d.ts:192
returns the color complement
Color
darken(amount: number): Color;Defined in: color/index.d.ts:179
Darken the color a given amount, from 0 to 100. Providing 100 will always return black.
| Parameter | Type | Description |
|---|---|---|
amount |
number |
(between 0 and 100) |
Color
desaturate(amount: number): Color;Defined in: color/index.d.ts:143
Desaturate the color a given amount, from 0 to 100. Providing 100 will is the same as calling greyscale.
| Parameter | Type | Description |
|---|---|---|
amount |
number |
(between 0 and 100) |
Color
equals(value: Color): boolean;Defined in: color/index.d.ts:59
Specifies whether this Color is equal to the Color parameter.
| Parameter | Type | Description |
|---|---|---|
value |
Color |
The Color to test. |
boolean
getBrightness(): number;Defined in: color/index.d.ts:95
return the brightness
number
getLuminance(): number;Defined in: color/index.d.ts:100
return the luminance
number
greyscale(): Color;Defined in: color/index.d.ts:157
Completely desaturates a color into greyscale. Same as calling desaturate(100).
Color
isDark(): boolean;Defined in: color/index.d.ts:83
return true if brightenss < 128
boolean
isLight(): boolean;Defined in: color/index.d.ts:89
return true if brightenss >= 128
boolean
lighten(amount: number): Color;Defined in: color/index.d.ts:165
Lighten the color a given amount, from 0 to 100. Providing 100 will always return white.
| Parameter | Type | Description |
|---|---|---|
amount |
number |
(between 0 and 100) |
Color
olor : Color
saturate(amount: number): Color;Defined in: color/index.d.ts:150
Saturate the color a given amount, from 0 to 100.
| Parameter | Type | Description |
|---|---|---|
amount |
number |
(between 0 and 100) |
Color
setAlpha(a: number): Color;Defined in: color/index.d.ts:107
Return this color (as a new Color instance) with the provided alpha
| Parameter | Type |
|---|---|
a |
number |
Color
spin(amount: number): Color;Defined in: color/index.d.ts:186
Spin the hue a given amount, from -360 to 360. Calling with 0, 360, or -360 will do nothing (since it sets the hue back to what it was before).
| Parameter | Type | Description |
|---|---|---|
amount |
number |
(between 0 and 100) |
Color
toHsl(): {
a: number;
h: number;
l: number;
s: number;
};Defined in: color/index.d.ts:112
return the hsl representation of the color
{
a: number;
h: number;
l: number;
s: number;
}a: number;h: number;l: number;s: number;toHslString(): string;Defined in: color/index.d.ts:118
return the CSS hsv representation of the color
string
toHsv(): {
a: number;
h: number;
s: number;
v: number;
};Defined in: color/index.d.ts:124
return the hsv representation of the color
{
a: number;
h: number;
s: number;
v: number;
}a: number;h: number;s: number;v: number;toHsvString(): string;Defined in: color/index.d.ts:130
return the CSS hsv representation of the color
string
toRgbString(): string;Defined in: color/index.d.ts:136
return the CSS rgb representation of the color
string
static equals(value1: Color, value2: Color): boolean;Defined in: color/index.d.ts:66
Compares two Color instances.
| Parameter | Type | Description |
|---|---|---|
value1 |
Color |
A Color to compare. |
value2 |
Color |
A Color to compare. |
boolean
static fromHSL(
a: any,
h: any,
s: any,
l: any): Color;Defined in: color/index.d.ts:204
returns a new Color from HSL
| Parameter | Type |
|---|---|
a |
any |
h |
any |
s |
any |
l |
any |
Color
static fromHSV(
a: any,
h: any,
s: any,
l: any): Color;Defined in: color/index.d.ts:205
| Parameter | Type |
|---|---|
a |
any |
h |
any |
s |
any |
l |
any |
Color
static fromIosColor(value: any): Color;Defined in: color/index.d.ts:77
Creates color from iOS-specific UIColor value representation.
| Parameter | Type |
|---|---|
value |
any |
Color
static isValid(value: any): boolean;Defined in: color/index.d.ts:72
Validates if a value can be converted to color.
| Parameter | Type | Description |
|---|---|---|
value |
any |
Input string. |
boolean
static mix(
color1: Color,
color2: Color,
amount: number): Color;Defined in: color/index.d.ts:198
returns the color complement
| Parameter | Type |
|---|---|
color1 |
Color |
color2 |
Color |
amount |
number |
Color