Represents a color object. Stores all color components (alpha (opacity), red, green, blue) in a [0..255] range.
Summary Constructors new Color(knownColor: string): Color
new Color(hex: string): Color
new Color(argb: number): Color
new Color(alpha: number, red: number, green: number, blue: number, type?: "rgb" | "hsl" | "hsv"): ColorProperties
Gets the Alpha component (in the [0, 255] range) of this color. This is a read-only property.
Gets the android-specific integer value representation. Same as the Argb one. This is a read-only property.
Gets the Argb Number representation of this color where each 8 bits represent a single color component. This is a read-only property.
Gets the Blue component (in the [0, 255] range) of this color. This is a read-only property.
Gets the Green component (in the [0, 255] range) of this color. This is a read-only property.
Gets the Hexadecimal string representation of this color. This is a read-only property.
Gets the iOS-specific UIColor value representation. This is a read-only property.
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.
Gets the Red component (in the [0, 255] range) of this color. This is a read-only property.
Methods brighten(amount: number): Color
Brighten the color a given amount, from 0 to 100.
returns the color complement
darken(amount: number): Color
Darken the color a given amount, from 0 to 100. Providing 100 will always return black.
desaturate(amount: number): Color
Desaturate the color a given amount, from 0 to 100. Providing 100 will is the same as calling greyscale.
equals(value: Color): boolean
Specifies whether this Color is equal to the Color parameter.
Returns boolean
return the [brightness](http://www.w3.org/TR/AERT#color-contrast)
Returns number
return the [luminance](http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef)
Returns number
Completely desaturates a color into greyscale. Same as calling desaturate(100).
return true if brightenss < 128
Returns boolean
return true if brightenss >= 128
Returns boolean
lighten(amount: number): Color
Lighten the color a given amount, from 0 to 100. Providing 100 will always return white.
saturate(amount: number): Color
Saturate the color a given amount, from 0 to 100.
setAlpha(a: number): Color
Return this color (as a new Color instance) with the provided alpha
spin(amount: number): Color
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).
toHsl(): {
a: number
h: number
l: number
}
return the hsl representation of the color
Returns { a: number h: number l: number }
return the [CSS hsv](https://www.w3schools.com/Css/css_colors_hsl.asp) representation of the color
Returns string
toHsv(): {
a: number
h: number
s: number
}
return the hsv representation of the color
Returns { a: number h: number s: number }
return the [CSS hsv](https://www.w3schools.com/Css/css_colors_rgb.asp) representation of the color
Returns string
return the [CSS rgb](https://www.w3schools.com/Css/css_colors_rgb.asp) representation of the color
Returns string
Compares two Color instances.
Returns boolean
fromHSL(a: any, h: any, s: any, l: any): Color
returns a new Color from HSL
fromHSV(a: any, h: any, s: any, l: any): Color
fromIosColor(value: any): Color
Creates color from iOS-specific UIColor value representation.
isValid(value: any): boolean
Validates if a value can be converted to color.
Returns boolean
returns the color complement
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4