API reference
Every public class, method, and event in @codexo/exojs. Generated from source.
classColor
32-bit RGBA color value with channel-wise accessors. Red, green, and blue are integers in 0..255; alpha is a float in 0..1. Out-of-range values are saturated on assignment (RGB clamped to 0..255 and truncated to an integer, alpha clamped to 0..1) - values outside the range no longer wrap around. The class predefines the eight corners of the RGB cube plus the two transparent ends as shared static instances (`Color.black`, `Color.magenta`, `Color.transparent`, ...). These instances are shared on purpose - do not mutate them; Color.clone first if you need a mutable starting point. Development builds freeze them, so writing to one throws there and passes unnoticed in production. Any other color is written as a value: `new Color(0x6495ed)`, `Color.fromHex('#6495ed')`, or channel by channel. Internally caches the packed RGBA32 representation and a normalized `Float32Array` for upload to GPU buffers; both are invalidated on channel writes and rebuilt lazily.
import { Color } from '@codexo/exojs'32-bit RGBA color value with channel-wise accessors. Red, green, and blue are integers in 0..255; alpha is a float in 0..1. Out-of-range values are saturated on assignment (RGB clamped to 0..255 and truncated to an integer, alpha clamped to 0..1) - values outside the range no longer wrap around.
The class predefines the eight corners of the RGB cube plus the two transparent ends as shared static instances (`Color.black`, `Color.magenta`, `Color.transparent`, ...). These instances are shared on purpose - do not mutate them; Color.clone first if you need a mutable starting point. Development builds freeze them, so writing to one throws there and passes unnoticed in production. Any other color is written as a value: `new Color(0x6495ed)`, `Color.fromHex('#6495ed')`, or channel by channel.
Internally caches the packed RGBA32 representation and a normalized `Float32Array` for upload to GPU buffers; both are invalidated on channel writes and rebuilt lazily.
new(rgb?: number, alpha?: number): Colornew(r: number, g: number, b: number, a?: number): Colorclone(): thiscopy(color: Color): thisdestroy(): voidequals(__namedParameters: Partial<Color>): booleanset(r: number, g: number, b: number, a: number): thissetHex(value: number | string, alpha?: number): thistoArray(normalized: boolean): Float32ArraytoHex(alpha: boolean, prefixed: boolean): stringtoRgb(): numbertoRgba8(): numbertoString(): stringfromCss(value: string, alpha?: number): ColorfromHex(value: number | string, alpha?: number): Colorblack: Colorblue: Colorcyan: Colorgreen: Colormagenta: Colorred: Colortransparent: ColortransparentBlack: ColortransparentWhite: Colorwhite: Coloryellow: Colora: numberb: numberg: numberr: number