RgbColor Class

An immutable representation of a color with red, green, and blue components each in the integer range [0, 255].

Methods

Name Description
constructor(r: number, g: number, b: number): RgbColor Constructs from red, green, and blue components.  
compareTo(other: RgbColor): number Compare this color to another color using the rules of an OrderedComparator.  
equals(other: RgbColor): boolean Returns true if this color's red, green, and blue components are identical to those of other.  
toColorDef(transparency: number = 0): ColorDef Converts this RgbColor to a ColorDef.  
toHexString(): string Convert this color to a string in the form "#rrggbb" where the values are the hex digits of the respective color components.  
toJSON(): RgbColorProps Convert this color to its JSON representation.  
fromColorDef(colorDef: ColorDef): RgbColor Static Constructs from the red, green, and blue components of a ColorDef.  
fromJSON(json: undefined | RgbColorProps): RgbColor Static Create an RgbColor from its JSON representation.  

Properties

Name Type Description
b Readonly number Blue  
g Readonly number Green  
r Readonly number Red  

Defined in

Last Updated: 16 April, 2024