A color space whose chroma-like coordinate is expressed relative to an RGB gamut: chroma = 1 is the most colorful in-gamut color for the rest of the coordinates, so any chroma in [0, 1] stays in gamut. The reduced coordinate (chroma, default "c") is rescaled against gamutSpace; every other coordinate is inherited unchanged from base. Works for any base whose chroma coordinate brings the color into gamut as it is reduced (e.g. OKLCh, LCH).

Hierarchy (view full)

  • Space
    • GamutRelativeColorSpace

Constructors

Properties

aliases?: string[]
base: Space
bases: Space[]

This space's ancestors, ordered closest first (immediate base → root), excluding this space

chromaIndex: number
coords: Record<string, CoordMeta>
displaySpaces?: Space[]

Spaces to try when serializing for display and this space is not natively supported

formats: Record<string, SpaceFormat>
gamutSpace: Space
id: string
linearGamut?: RGBColorSpace
M: Record<string, Matrix3x3>

Matrices relevant to this color space, keyed by a descriptive name

method: string
name: string
oogChroma: number
referred?: string
rgbGamut?: RGBColorSpace
white: White
DEFAULT_FORMAT: {
    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
    • Optionaloptions: {
          epsilon?: number;
      }
      • Optionalepsilon?: number

    Returns boolean

  • The highest in-gamut value of the reduced coordinate for the given coordinates. The reduced coordinate's own value is ignored; the others determine the result.

    Parameters

    • coords: number[]

    Returns number

  • Parameters

    • ref: Ref
    • OptionalworkingSpace: string | Space

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

    If no space or an unknown space is provided