Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ColourHex

Represents a colour value as hex. Normalizes various inputs

example
Create with hex string const hex = new Hex('#000000'); hex.toString(); // -> '#000000'
example
Create with shortened hex string const hex = new Hex('#000'); hex.toString(); // -> '#000000'
example
Create with missing hash const hex = new Hex('000000'); hex.toString(); // -> '#000000'
example
Create with RGB const hex = new Hex({ red: 0, green: 0, blue: 0 }); hex.toString(); // -> '#000000'

Hierarchy

  • ColourHex

Index

Constructors

Accessors

Methods

Constructors

constructor

  • new ColourHex(value: string | IRgb): ColourHex

Accessors

value

  • get value(): string

Methods

__@toPrimitive

  • __@toPrimitive(hint: "string" | "number" | "default"): number | string
  • Parameters

    • hint: "string" | "number" | "default"

    Returns number | string

toIRgb

  • toIRgb(): IRgb

toString

  • toString(): string

valueOf

  • valueOf(): string