Skip to content

luxe: color


import "luxe: color" for Color

Access to color APIs. Note that this is not done at all.

Color.white : Color

A constant for [1,1,1,1]. Note: don’t modify the return value.

Color.black : Color

A constant for [0,0,0,1]. Note: don’t modify the return value.

Color.clear : Color

A constant for [0,0,0,0]. Note: don’t modify the return value.

Color.pink : Color

The luxe pink color used everywhere. Note: don’t modify the return value.

Color.red : Color

The luxe red color. Note: don’t modify the return value.

Color.green : Color

The luxe green color. Note: don’t modify the return value.

Color.blue : Color

The luxe blue color. Note: don’t modify the return value.

Color.hex(value : Num) : Color

Returns a new color from the specified hex color value.

var color = Color.hex(0xFF00AA)

Color.clone(other : Color, alpha : Num) : unknown

Returns a new color from the specified color with a different alpha.

var other = Color.hex(0xFF00AA)
var color = Color.clone(other, 0.5)

Color.hex_string(color : Color) : String

Returns a hex string from the specified color.

Color.hex_string(Color.white) //#FFFFFF

Color.hex_string(color : Color, alpha : Bool) : String

Returns a hex string from the specified color. If alpha is true, includes the alpha component.

Color.hex_string(Color.white, true) //#FFFFFFFF

Color.hex(value : Num, alpha : Num) : Color

Returns a new color from the specified hex color value, with the specified alpha value.

var color = Color.hex(0xFF00AA, 0.5)

Color.hex_set(color : Color, hex : Num) : unknown

Set an existing color to the specified hex color value.

var color = Color.hex_set(0xFF00AA)

Color.hex_color(color : Color) : Num

Get the hex color value of a color

Color.hex_color(color : Color, include_alpha : Bool) : Num

Get the hex color value of a color, either 3 byte or 4 byte with alpha

Color.linear_to_srgb(color : Color) : Color

Convert a linear color to sRGB (2.2 gamma)

Color.srgb_to_linear(color : Color) : Color

Convert an sRGB color to linear (2.2 gamma)

Color.lerp(from : Color, to : Color, t : Num) : Color

Linearly interpolate between two colors, using t as the distance between the two in 0…1 range. To blend two colors half and half, you’d use lerp(from, to, 0.5). If t is 0, from is returned and if t is 1, to is returned.

Color.lerp(from : Color, to : Color, t : Num, into : Color) : unknown

Linearly interpolate between two colors, storing the result in the existing color into. t is the distance between the two in 0…1 range. To blend two colors half and half, you’d use lerp(from, to, 0.5). If t is 0, from is returned and if t is 1, to is returned.

Color.rgb2hsv(rgb : Color) : Color

Convert from an RGB format color to an HSV format.

Color.hsv2rgb(hsv : Color) : Color

Convert an HSV format color to an RGB format.

Color.color_from_hue(hue : Num) : Color

Create a color from the given hue, in a 0…1 range. Values outside 0…1 are wrapped into 0…1 range.

Color.linear_srgb_to_oklab(r : Num, g : Num, b : Num) : unknown

no docs found

Color.oklab_to_linear_srgb(L : Num, a : Num, b : Num) : unknown

no docs found

Color.okhsl_to_srgb(h : Num, s : Num, l : Num) : unknown

no docs found

Color.srgb_to_okhsl(r : Num, g : Num, b : Num) : unknown

no docs found

Color.okhsv_to_srgb(h : Num, s : Num, v : Num) : unknown

no docs found

Color.srgb_to_okhsv(r : Num, g : Num, b : Num) : unknown

no docs found

Color.find_cusp(a : Any, b : Any) : unknown

no docs found

Color.compute_max_saturation(a : Num, b : Num) : unknown

no docs found

Color.find_gamut_intersection(a : Any, b : Any, L1 : Any, C1 : Any, L0 : Any, cusp : Any) : unknown

no docs found