Interface LabColor

A Lab (CIELAB) color object.

interface LabColor {
    a: number;
    b: number;
    l: number;
    opacity: number;
    brighter(k?): LabColor;
    copy(values?): LabColor;
    darker(k?): LabColor;
    displayable(): boolean;
    formatHex(): string;
    formatHex8(): string;
    formatHsl(): string;
    formatRgb(): string;
    hex(): string;
    rgb(): RGBColor;
    toString(): string;
}

Hierarchy

Methods

  • Returns a brighter copy of this color. If k is specified, it controls how much brighter the returned color should be. If k is not specified, it defaults to 1.

    Parameters

    • Optional k: number

      A color space dependent number to determine, how much brighter the returned color should be.

    Returns LabColor

  • Returns a copy of this color.

    Parameters

    • Optional values: {
          a?: number;
          b?: number;
          l?: number;
          opacity?: number;
      }

      If values is specified, any enumerable own properties of values are assigned to the new returned color.

      • Optional a?: number
      • Optional b?: number
      • Optional l?: number
      • Optional opacity?: number

    Returns LabColor

  • Returns a darker copy of this color. If k is specified, it controls how much darker the returned color should be. If k is not specified, it defaults to 1.

    Parameters

    • Optional k: number

      A color space dependent number to determine, how much darker the returned color should be.

    Returns LabColor

  • Returns true if and only if the color is displayable on standard hardware. For example, this returns false for an RGB color if any channel value is less than zero or greater than 255, or if the opacity is not in the range [0, 1].

    Returns boolean

  • Returns a hexadecimal string representing this color in RGB space, such as #f7eaba. If this color is not displayable, a suitable displayable color is returned instead. For example, RGB channel values greater than 255 are clamped to 255.

    Returns string

  • Returns a hexadecimal string representing this color in RGBA space, such as #f7eaba90. If this color is not displayable, a suitable displayable color is returned instead. For example, RGB channel values greater than 255 are clamped to 255.

    Returns string

  • Returns a string representing this color according to the CSS Color Module Level 3 specification, such as hsl(257, 50%, 80%) or hsla(257, 50%, 80%, 0.2). If this color is not displayable, a suitable displayable color is returned instead by clamping S and L channel values to the interval [0, 100].

    Returns string

  • Returns a string representing this color according to the CSS Object Model specification, such as rgb(247, 234, 186) or rgba(247, 234, 186, 0.2). If this color is not displayable, a suitable displayable color is returned instead by clamping RGB channel values to the interval [0, 255].

    Returns string

  • Returns string

    Deprecated

    Use color.formatHex.

  • Returns a string representing this color according to the CSS Object Model specification, such as rgb(247, 234, 186) or rgba(247, 234, 186, 0.2). If this color is not displayable, a suitable displayable color is returned instead. For example, RGB channel values greater than 255 are clamped to 255.

    Returns string

Properties

a: number

Position between red/magenta and green typically in [-160, +160].

b: number

Position between yellow and blue typically in [-160, +160].

l: number

Lightness typically in the range [0, 100].

opacity: number

Opacity value