Constructors

  • Simple object representing an RGBA color can be initialized from any valid CSS Expression

    Parameters

    • color: string

    Returns Color

Methods

  • compares color with specified one and returns the color contrast defined by (WCAG Version 2)

    Parameters

    Returns number

  • returns the colors original format possible values: rgb, rgba, hsl, hsla, hex6, hex3, name

    Returns string

  • returns the original input value

    Returns string

  • returns an opaque representation of this color

    Parameters

    • Optionalopacity: number

      optional opacity ranging from 0 (fully transparent) to 1 (fully opaque). default is 1.

    Returns Color

  • returns the color in RGBA format rgb are in range [0-255] a is in range [0-1]

    Returns { a: number; b: number; g: number; r: number }

  • returns the "best" text color (either white or black) for use on a background of this color algorithm always ensures a minimum contrast ratio of 3:1 as per [ISO-9241-3] and [ANSI-HFES-100-1988]

    Returns Color

  • check if color is transparent

    Returns boolean

  • Returns boolean

  • returns the most compact representation of the input value

    Returns string

  • returns the original input value

    Returns string

  • Parameters

    • expression: string

    Returns null | string

  • returns an opaque representation of the specified color

    Parameters

    • color: string | Color
    • Optionalopacity: number

      optional opacity ranging from 0 (fully transparent) to 1 (fully opaque). default is 1.

    Returns string

  • returns the "best" text color (either white or black) for use on a background of this color algorithm always ensures a minimum contrast ratio of 3:1 as per [ISO-9241-3] and [ANSI-HFES-100-1988]

    Parameters

    Returns string

  • Parameters

    Returns boolean

  • check if specified color is transparent

    Parameters

    • Optionalcolor: null | string

    Returns boolean

  • Parameters

    • Optionalexpression: null | string

    Returns null | Color

  • return a random color with the specified brightness

    Parameters

    • Optionalsaturation: number

      saturation of the color. default 0.9

    • Optionallightness: number

      lightness of the color. default 0.6

    • Optionalsteps: number

      number of steps. default 30 (12 degree each)

    • Optionalstep: number

      index of a specific step. randomized by default

    Returns string

  • Parameters

    • expression: string

    Returns boolean