Color:

0-255 RGBA color.

groupMath

r: number

Red (0-255.

g: number

Green (0-255).

b: number

Blue (0-255).

fromArray(arr: [ number, number, number ] ): Color

fromHex(hex: string | number): Color

Create color from hex string or literal.

Color.fromHex(0xfcef8d)
Color.fromHex("#5ba675")
Color.fromHex("d46eb3")

sincev3000.0

fromHSL(h: number, s: number, l: number): Color

fromCSS(cssColor: CSSColor): Color

Create a color from a CSS color name

paramcssColor- The color name.

loadHappy();

add([
    rect(512, 512, {
        radius: [0, 96, 96, 96]
    }),
    color("#663399"),
    pos(40, 40),
]);

add([
    text("css", { size: 192, font: "happy" }),
    pos(90, 310)
]);

static

returnsThe color.

experimentalThis feature is in experimental phase, it will be fully released in v3001.1.0

lighten(a: number): Color

Lighten the color (adds RGB by n).

darken(a: number): Color

Darkens the color (subtracts RGB by n).

mult(other: Color): Color

lerp(dest: Color, t: number): Color

Linear interpolate to a destination color.

sincev3000.0

toHSL(): [ number, number, number ]

Convert color into HSL format.

sincev3001.0

eq(other: Color): boolean

toHex(): string

Return the hex string of color.

sincev3000.0

toArray(): Array<number>

Return the color converted to an array.

sincev3001.0

kaplay logo

Misc

Layer