Color

external class Color(var red: Double = definedExternally, var green: Double = definedExternally, var blue: Double = definedExternally, var alpha: Double = definedExternally)(source)

A color, specified using red, green, blue, and alpha values, which range from 0 (no intensity) to 1.0 (full intensity).

See also

Constructors

Link copied to clipboard
constructor(red: Double = definedExternally, green: Double = definedExternally, blue: Double = definedExternally, alpha: Double = definedExternally)

Types

Link copied to clipboard

Properties

Link copied to clipboard

The alpha component. Default value - 1.0

Link copied to clipboard

The blue component. Default value - 1.0

Link copied to clipboard

The green component. Default value - 1.0

Link copied to clipboard
var red: Double

The red component. Default value - 1.0

Functions

Link copied to clipboard
fun brighten(magnitude: Double, result: Color): Color

Brightens this color by the provided magnitude.

Link copied to clipboard
fun clone(result: Color? = definedExternally): Color

Returns a duplicate of a Color instance.

Link copied to clipboard
fun darken(magnitude: Double, result: Color): Color

Darkens this color by the provided magnitude.

Link copied to clipboard
fun equalsEpsilon(other: Color, epsilon: Double? = definedExternally): Boolean

Returns true if this Color equals other componentwise within the specified epsilon.

Link copied to clipboard
fun toBytes(result: ReadonlyArray<Double>? = definedExternally): ReadonlyArray<Double>

Converts this color to an array of red, green, blue, and alpha values that are in the range of 0 to 255.

Link copied to clipboard

Creates a string containing the CSS color value for this color.

Link copied to clipboard

Creates a string containing CSS hex string color value for this color.

Link copied to clipboard
fun toRgba(): Double

Converts this color to a single numeric unsigned 32-bit RGBA value, using the endianness of the system.

Link copied to clipboard
fun withAlpha(alpha: Double, result: Color? = definedExternally): Color

Creates a new Color that has the same red, green, and blue components as this Color, but with the specified alpha value.