s2maps-gpu - v0.18.0
    Preparing search index...

    Class Color

    Color manager

    Color class to handle color conversions and adjustments. Supports RGB, HSV, HSL, and LCH.

    ex. name string

    const color = new Color('red');
    const rgb = color.getRGB();

    ex. Hex string

    const color = new Color('#ff0000');
    const rgb = color.getRGB();

    ex. String input array

    const color = new Color('hsv(180, 0.9, 0.7843137254901961)');
    const rgb = color.getRGB();

    ex. RGBA array

    const color = new Color(255, 0, 0, 1, 'rgb');
    const rgb = color.getRGB();
    Index

    Constructors

    • Parameters

      • x: string | number | Color = 0

        either an input color, string defining a color, or first color value

      • y: number = 0

        second color value

      • z: number = 0

        third color value

      • a: number = 1

        alpha value

      • type: string = 'rgb'

        color type

      Returns Color

    Methods

    • Get the rgb values of the color

      Parameters

      • normalize: boolean = true

        whether to normalize the values

      • OptionalcbAdjust: ColorBlindAdjust

        colorblind adjustment

      Returns ColorArray

      Color as [r, g, b, a]

    • Convert hsl to rgb

      Returns void

    • Convert hsv to rgb

      Returns void

    • Convert lab to lch

      Returns void

    • Convert lab to rgb

      Returns void

    • Convert lch to lab

      Returns void

    • Convert rgb to hsv

      Returns void

    • Convert rgb to lab

      Returns void

    • Returns this

      the hsv values of the color

    • Returns this

      the lch values of the color

    • Returns this

      the rgb values of the color

    • Get a white color via interpolation

      Parameters

      • t: number

        input value

      Returns Color

      white color at t

    • Get a sinebow color via interpolation input value

      Parameters

      • t: number

        input value

      Returns Color

      sinebow color at t

    • Get a sinebow extended color via interpolation

      Parameters

      • t: number

        input value

      Returns Color

      sinebow extended color at t