Class Color

The Color class is a color based on RGBA.

Hierarchy

  • Color

Constructors

  • Constructs a color with the red, green, blue, and the alpha.

    Parameters

    • red: number = 255
    • green: number = 255
    • blue: number = 255
    • alpha: number = 1.0

    Returns Color

Properties

m_alpha: number
m_blue: number
m_green: number
m_red: number

Accessors

  • get alpha(): number
  • Returns the alpha color component of this color.

    Returns number

  • set alpha(alpha): void
  • Sets the alpha color component of this color to alpha that is specified in the range 0-1.0.

    Parameters

    • alpha: number

    Returns void

  • get blue(): number
  • Returns the blue color component of this color.

    Returns number

  • set blue(blue): void
  • Sets the blue color component of this color to blue that is specified in the range 0-255.

    Parameters

    • blue: number

    Returns void

  • get green(): number
  • Returns the green color component of this color.

    Returns number

  • set green(green): void
  • Sets the green color component of this color to green that is specified in the range 0-255.

    Parameters

    • green: number

    Returns void

  • get hex(): string
  • Returns the string of this color in the specified format("#RRGGBB").

    Returns string

  • get red(): number
  • Returns the red color component of this color.

    Returns number

  • set red(red): void
  • Sets the red color component of this color to red that is specified in the range 0-255.

    Parameters

    • red: number

    Returns void

  • get rgba(): string
  • Returns the rgba string("rgba(r, g, b, a)") of this color.

    Returns string

Methods

  • Returns a copy of this color.

    Returns Color

  • Returns true if this color and other are equal; otherwise returns false.

    Parameters

    Returns boolean

  • Copies the other color to this color.

    Parameters

    Returns void

  • Returns a darker color, but does not change this color.

    Parameters

    • dark: number

    Returns Color

  • Returns a lighter color, but does not change this color.

    Parameters

    • light: number

    Returns Color

  • Returns the HSB value of this color.

    Returns HSB

  • Returns the RGB value of this color.

    Returns RGB

  • Returns the RGBA value of this color.

    Returns RGBA

  • Returns a color constructed from the HSB, h (hue), s (saturation), b (brightness). The value of s, v must all be in the range 0-100; the value of h must be in the range 0-360.

    Parameters

    Returns Color

  • Returns a color parsed from hex string("#RRGGBB").

    Parameters

    • hex: string

    Returns Color

  • Returns a color constructed from the given rgb.

    Parameters

    Returns Color

  • Returns a color constructed from the given rgba. The alpha component of the color should be within the range of 0 to 1.0.

    Parameters

    Returns Color

  • Returns a random color.

    Returns Color

Generated using TypeDoc