Classes
Color
Color
Represents a color object. Stores all color components (alpha (opacity), red, green, blue) in a [0..255] range.
Summary β
Constructors
Constructors β
constructor β
new Color(knownColor: string): Color
defined in @nativescript/core/color/index.d.ts:5:1
Parameter Default Description
knownColor
string
Returns Color
new Color(hex: string): Color
defined in @nativescript/core/color/index.d.ts:6:1
Parameter Default Description
hex
string
Returns Color
new Color(argb: number): Color
defined in @nativescript/core/color/index.d.ts:7:1
Parameter Default Description
argb
number
Returns Color
new Color(alpha: number, red: number, green: number, blue: number, type?: "rgb" | "hsl" | "hsv"): Color
defined in @nativescript/core/color/index.d.ts:8:1
Parameter Default Description
alpha
number
red
number
green
number
blue
number
type
"rgb" | "hsl" | "hsv"
Returns Color
Properties β
a β
defined in @nativescript/core/color/index.d.ts:13:8
Gets the Alpha component (in the [0, 255] range) of this color. This is a read-only property.
android β
defined in @nativescript/core/color/index.d.ts:48:1
Gets the android-specific integer value representation. Same as the Argb one. This is a read-only property.
argb β
defined in @nativescript/core/color/index.d.ts:38:8
Gets the Argb Number representation of this color where each 8 bits represent a single color component. This is a read-only property.
b β
defined in @nativescript/core/color/index.d.ts:28:8
Gets the Blue component (in the [0, 255] range) of this color. This is a read-only property.
g β
defined in @nativescript/core/color/index.d.ts:23:8
Gets the Green component (in the [0, 255] range) of this color. This is a read-only property.
hex β
defined in @nativescript/core/color/index.d.ts:33:8
Gets the Hexadecimal string representation of this color. This is a read-only property.
ios β
defined in @nativescript/core/color/index.d.ts:53:1
Gets the iOS-specific UIColor value representation. This is a read-only property.
name β
defined in @nativescript/core/color/index.d.ts:43:8
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 β
defined in @nativescript/core/color/index.d.ts:18:8
Gets the Red component (in the [0, 255] range) of this color. This is a read-only property.
Methods β
brighten β
brighten(amount: number): Color
defined in @nativescript/core/color/index.d.ts:172:1
Brighten the color a given amount, from 0 to 100.
Parameter Default Description
amount
number
(between 0 and 100)
Returns Color
darken β
darken(amount: number): Color
defined in @nativescript/core/color/index.d.ts:179:1
Darken the color a given amount, from 0 to 100. Providing 100 will always return black.
Parameter Default Description
amount
number
(between 0 and 100)
Returns Color
desaturate β
desaturate(amount: number): Color
defined in @nativescript/core/color/index.d.ts:143:1
Desaturate the color a given amount, from 0 to 100. Providing 100 will is the same as calling greyscale.
Parameter Default Description
amount
number
(between 0 and 100)
Returns Color
equals β
equals(value: Color): boolean
defined in @nativescript/core/color/index.d.ts:59:1
Specifies whether this Color is equal to the Color parameter.
Parameter Default Description
Returns boolean
getBrightness β
defined in @nativescript/core/color/index.d.ts:95:1
return the [brightness](http://www.w3.org/TR/AERT#color-contrast)
Returns number
getLuminance β
defined in @nativescript/core/color/index.d.ts:100:1
return the [luminance](http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef)
Returns number
greyscale β
greyscale(): Color
defined in @nativescript/core/color/index.d.ts:157:1
Completely desaturates a color into greyscale. Same as calling desaturate(100).
Returns Color
isDark β
isLight β
lighten β
lighten(amount: number): Color
defined in @nativescript/core/color/index.d.ts:165:1
Lighten the color a given amount, from 0 to 100. Providing 100 will always return white.
Parameter Default Description
amount
number
(between 0 and 100)
Returns Color
saturate β
saturate(amount: number): Color
defined in @nativescript/core/color/index.d.ts:150:1
Saturate the color a given amount, from 0 to 100.
Parameter Default Description
amount
number
(between 0 and 100)
Returns Color
setAlpha β
setAlpha(a: number): Color
defined in @nativescript/core/color/index.d.ts:107:1
Return this color (as a new Color instance) with the provided alpha
Parameter Default Description
a
number
Returns Color
spin β
spin(amount: number): Color
defined in @nativescript/core/color/index.d.ts:186:1
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 Default Description
amount
number
(between 0 and 100)
Returns Color
toHsl β
defined in @nativescript/core/color/index.d.ts:112:1
return the hsl representation of the color
Returns {
a: number
h: number
l: number
}
toHslString β
defined in @nativescript/core/color/index.d.ts:118:1
return the [CSS hsv](https://www.w3schools.com/Css/css_colors_hsl.asp) representation of the color
Returns string
toHsv β
defined in @nativescript/core/color/index.d.ts:124:1
return the hsv representation of the color
Returns {
a: number
h: number
s: number
}
toHsvString β
defined in @nativescript/core/color/index.d.ts:130:1
return the [CSS hsv](https://www.w3schools.com/Css/css_colors_rgb.asp) representation of the color
Returns string
toRgbString β
defined in @nativescript/core/color/index.d.ts:136:1
return the [CSS rgb](https://www.w3schools.com/Css/css_colors_rgb.asp) representation of the color
Returns string
equals β
Static
fromHSL β
Static
fromHSL(a: any, h: any, s: any, l: any): Color
defined in @nativescript/core/color/index.d.ts:204:1
returns a new Color from HSL
Parameter Default Description
a
any
h
any
s
any
l
any
Returns Color
fromHSV β
Static
fromHSV(a: any, h: any, s: any, l: any): Color
defined in @nativescript/core/color/index.d.ts:205:1
Parameter Default Description
a
any
h
any
s
any
l
any
Returns Color
fromIosColor β
Static
fromIosColor(value: any): Color
defined in @nativescript/core/color/index.d.ts:77:1
Creates color from iOS-specific UIColor value representation.
Parameter Default Description
value
any
Returns Color
isValid β
Static
defined in @nativescript/core/color/index.d.ts:72:1
Validates if a value can be converted to color.
Parameter Default Description
value
any
Input string.
Returns boolean
- Previous
- CoercibleProperty
- Next
- ContainerView
On this page