Options
All
  • Public
  • Public/Protected
  • All
Menu
classdesc

A color class, inspired by neolitec's Javascript class. Original found at https://gist.github.com/neolitec/1344610 Thanks to neolitec

Hierarchy

  • Color

Index

Constructors

constructor

Properties

a

a: number
member

{number}

memberof

Color

instance

b

b: number
member

{number}

memberof

Color

instance

g

g: number
member

{number}

memberof

Color

instance

h

h: number
member

{number}

memberof

Color

instance

l

l: number
member

{number}

memberof

Color

instance

r

r: number
member

{number}

memberof

Color

instance

s

s: number
member

{number}

memberof

Color

instance

Methods

alpha

  • alpha(): number

blue

  • blue(): number
  • Get the blue component of this RGB(A) color. This method just returns the b color attribute.

    method

    blue

    instance
    memberof

    Color

    Returns number

    A value between 0.0 and 1.0.

clone

cssHEX

  • cssHEX(): string

cssHSL

  • cssHSL(): string

cssHSLA

  • cssHSLA(): string

cssRGB

  • cssRGB(): string

cssRGBA

  • cssRGBA(): string

darken

  • darken(v: string | number): Color

desaturate

  • desaturate(v: string | number): Color

fadein

  • fadein(v: string | number): Color

fadeout

  • fadeout(v: string | number): Color

green

  • green(): number
  • Get the green component of this RGB(A) color. This method just returns the g color attribute.

    method

    green

    instance
    memberof

    Color

    Returns number

    A value between 0.0 and 1.0.

hue

  • hue(): number
  • Get the hue component of this HSL(A) color. This method just returns the h color attribute.

    method

    hue

    instance
    memberof

    Color

    Returns number

    A value between 0.0 and 1.0.

interpolate

  • Interpolate this color on the RGB scale.

    method

    interpolate

    instance
    memberof

    Color

    Parameters

    • c: Color

      The color to interpolate to.

    • t: number

      An interpolation value between 0.0 and 1.0.

    Returns Color

    A clone of this color (in RGB mode).

lighten

  • lighten(v: string | number): Color

lightness

  • lightness(): number
  • Get the lightness component of this HSL(A) color. This method just returns the l color attribute.

    method

    lightness

    instance
    memberof

    Color

    Returns number

    A value between 0.0 and 1.0.

red

  • red(): number
  • Get the red component of this RGB(A)color. This method just returns the r color attribute.

    method

    red

    instance
    memberof

    Color

    Returns number

    A value between 0.0 and 1.0.

saturate

  • saturate(v: string | number): Color

saturation

  • saturation(): number
  • Get the saturation component of this HSL(A) color. This method just returns the s color attribute.

    method

    saturation

    instance
    memberof

    Color

    Returns number

    A value between 0.0 and 1.0.

set

setAlpha

  • setAlpha(a: number): this

setBlue

  • setBlue(b: number): this

setGreen

  • setGreen(g: number): this

setHue

  • setHue(h: number): this

setLuminance

  • setLuminance(l: number): this

setRed

  • setRed(r: number): this

setSaturation

  • setSaturation(s: number): this

spin

  • spin(v: string | number): Color

Static makeHEX

  • makeHEX(value: string): Color

Static makeHSL

  • makeHSL(...args: Array<number | string>): Color

Static makeRGB

  • makeRGB(...args: any[]): Color

Static parse

  • parse(str: string): Color | null
  • Parse the given color string. Currently only these formate are recognized: hex, rgb, rgba.

    method

    parse

    static
    memberof

    Color

    Parameters

    • str: string

      The string representation to parse.

    Returns Color | null

    The color instance that's represented by the given string.

Object literals

Static Private Converter

Converter: object

HSLToRGB

  • HSLToRGB(color: Color): void

RGBToHSL

  • RGBToHSL(color: Color): void

hue2rgb

  • hue2rgb(p: number, q: number, t: number): number

Static Private Sanitizer

Sanitizer: object

HSL

  • HSL(...args: Array<string | number>): Array<number>

RGB

  • RGB(...args: any[]): number[]

Static Private Validator

Validator: object

checkHEX

  • checkHEX(value: string): void

Legend

  • Constructor
  • Property
  • Method
  • Property
  • Method
  • Inherited property
  • Inherited method
  • Private property
  • Private method
  • Static property
  • Static method

Generated using TypeDoc