Convenience class for RGB color spaces

Hierarchy (view full)

Constructors

  • Creates a new RGB ColorSpace. If coords are not specified, they will use the default RGB coords. Instead of fromBase() and toBase() functions, you can specify to/from XYZ matrices and have toBase() and fromBase() automatically generated.

    Parameters

    Returns RGBColorSpace

Properties

aliases?: string[]
base: Space
coords: Record<string, CoordMeta>
formats: Record<string, SpaceFormat>
fromBase?: ((coords) => Coords)

Type declaration

gamutSpace: Space
id: string
name: string
referred?: string
toBase?: ((coords) => Coords)

Type declaration

white: White
DEFAULT_FORMAT: {
    name: "color";
    type: "functions";
}

Type declaration

  • name: "color"
  • type: "functions"
registry: Record<string, Space>

Accessors

  • get cssId(): string
  • The ID used by CSS, such as display-p3 or --cam16-jmh

    Returns string

  • get isPolar(): boolean
  • Returns boolean

  • get isUnbounded(): boolean
  • Returns boolean

Methods

  • Parameters

    • coords: Coords
    • Optional options: {
          epsilon?: number;
      }
      • Optional epsilon?: number

    Returns boolean

  • Parameters

    • ref: Ref
    • Optional workingSpace: string | Space

    Returns CoordMeta & {
        id: string;
        index: number;
        space: Space;
    }

    Throws

    If no space or an unknown space is provided