Interface CubehelixColor

Dave Green’s Cubehelix color object.

interface CubehelixColor {
    h: number;
    l: number;
    opacity: number;
    s: number;
    brighter(k?): CubehelixColor;
    copy(values?): CubehelixColor;
    darker(k?): CubehelixColor;
    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 CubehelixColor

  • Returns a copy of this color.

    Parameters

    • Optional values: {
          h?: number;
          l?: number;
          opacity?: number;
          s?: number;
      }

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

      • Optional h?: number
      • Optional l?: number
      • Optional opacity?: number
      • Optional s?: number

    Returns CubehelixColor

  • 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 CubehelixColor

  • 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

h: number

Hue channel value.

l: number

Lightness channel value.

opacity: number

Opacity value.

s: number

Saturation channel value.