@tempots/color

RGB class

Represents a color in the RGB color model.

Signature:

declare class RGB 

Constructors

Constructor

Modifiers

Description

(constructor)(value)

Creates a new RGB instance.

Properties

Property

Modifiers

Type

Description

blue

readonly

number

Gets the blue channel value of the color.

equals

readonly

(other: RGB) => boolean

Checks if the color is equal to another RGB instance.

fromRGB

static

readonly

(r: number, g: number, b: number) => RGB

Creates an RGB instance from individual RGB channel values.

fromString

static

readonly

(s: string) => RGB

Creates an RGB instance from a string representation of a color in the format "#RRGGBB".

green

readonly

number

Gets the green channel value of the color.

ofChannels

static

readonly

([r, g, b]: [r: number, g: number, b: number]) => RGB

Creates an RGB instance from an array of normalized RGB channel values.

red

readonly

number

Gets the red channel value of the color.

toChannels

readonly

() => [number, number, number]

Converts the color to an array of normalized RGB channel values.

toString

readonly

() => string

Converts the color to a string representation in the format "#RRGGBB".

value

readonly

number