Canvas Toolkit
← Class index

CColor

GUI and styling

Represents an RGBA color value.

import { CColor } from "canvas-toolkit-lib";

Declared members

constructor(red?: number, green?: number, blue?: number, alpha?: number);

Creates a new CColor instance. @param red Red. @param green Green. @param blue Blue. @param alpha Alpha.

setColor(color: string): void;

Assigns a color to the specified palette role. @param color Color.

setAlpha(alpha: number): void;

Sets the alpha. @param alpha Alpha.

red(): number;

Returns or updates the red value. @returns The resulting value.

green(): number;

Returns or updates the green value. @returns The resulting value.

blue(): number;

Returns or updates the blue value. @returns The resulting value.

alpha(): number;

Returns or updates the alpha value. @returns The resulting value.

equals(other: CColor): boolean;

Returns whether this object is equal to another object. @param other Other. @returns The resulting value.

toCss(): string;

Returns the color as a CSS color string. @returns The resulting value.

toHex(): string;

Returns the color as a hexadecimal RGB string. @returns The resulting value.