Skip to content
KCKingdoms Connected Scripting APIScripting guides and API
Runtime classServer APIGenerated

Color

Defined in: server/api.d.ts:8161

Mutable RGBA color, with components stored from 0 to 1.

new Color(r, g, b, a?): Color

Defined in: server/api.d.ts:8169

Creates a color from normalized RGBA components.

number

Initial red component from 0 to 1.

number

Initial green component from 0 to 1.

number

Initial blue component from 0 to 1.

number

Optional alpha component from 0 to 1; defaults to 1.

Color

clone(): Color

Defined in: server/api.d.ts:8213

Creates an independent copy of this color.

Color

New color with the same components.


lerp(target, t): this

Defined in: server/api.d.ts:8197

Linearly interpolates every component toward a target in place.

Color

Destination color.

number

Interpolation factor; 0 keeps this color and 1 reaches target.

this

This mutated color for chaining.


set(r, g, b, a?): this

Defined in: server/api.d.ts:8207

Replaces this color’s normalized components in place.

number

Replacement red component from 0 to 1.

number

Replacement green component from 0 to 1.

number

Replacement blue component from 0 to 1.

number

Optional replacement alpha; defaults to 1 when omitted.

this

This mutated color for chaining.


toHex(includeAlpha?): string

Defined in: server/api.d.ts:8220

Converts normalized components to a hexadecimal CSS-style string.

boolean

Whether to append the alpha byte; defaults to false.

string

Lowercase #rrggbb or #rrggbbaa string.


toJSON(): object

Defined in: server/api.d.ts:8232

Converts this color to a plain object for JSON.stringify.

object

Object containing the current normalized components.

a: number

b: number

g: number

r: number


toString(): string

Defined in: server/api.d.ts:8226

Formats this color for logging and debugging.

string

Text in Color(r, g, b, a) form.


static black(): Color

Defined in: server/api.d.ts:8261

Creates opaque black.

Color

New Color(0, 0, 0, 1).


static blue(): Color

Defined in: server/api.d.ts:8279

Creates opaque blue.

Color

New Color(0, 0, 1, 1).


static cyan(): Color

Defined in: server/api.d.ts:8291

Creates opaque cyan.

Color

New Color(0, 1, 1, 1).


static fromHex(hex): Color

Defined in: server/api.d.ts:8239

Parses a hexadecimal color string.

string

Hexadecimal color in #RRGGBB or #RRGGBBAA form; the leading # is optional. Three- and four-digit shorthands are not supported.

Color

Parsed color, or opaque white when the input is invalid.


static fromRGB(r, g, b, a?): Color

Defined in: server/api.d.ts:8249

Creates a normalized color from byte components.

number

Red byte from 0 to 255.

number

Green byte from 0 to 255.

number

Blue byte from 0 to 255.

number

Optional alpha byte from 0 to 255; defaults to 255.

Color

New normalized color.


static green(): Color

Defined in: server/api.d.ts:8273

Creates opaque green.

Color

New Color(0, 1, 0, 1).


static magenta(): Color

Defined in: server/api.d.ts:8297

Creates opaque magenta.

Color

New Color(1, 0, 1, 1).


static red(): Color

Defined in: server/api.d.ts:8267

Creates opaque red.

Color

New Color(1, 0, 0, 1).


static transparent(): Color

Defined in: server/api.d.ts:8303

Creates fully transparent black.

Color

New Color(0, 0, 0, 0).


static white(): Color

Defined in: server/api.d.ts:8255

Creates opaque white.

Color

New Color(1, 1, 1, 1).


static yellow(): Color

Defined in: server/api.d.ts:8285

Creates opaque yellow.

Color

New Color(1, 1, 0, 1).

a: number

Defined in: server/api.d.ts:8189

Mutable normalized alpha component.


b: number

Defined in: server/api.d.ts:8184

Mutable normalized blue component.


g: number

Defined in: server/api.d.ts:8179

Mutable normalized green component.


r: number

Defined in: server/api.d.ts:8174

Mutable normalized red component.