Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Color defines a color value with red, green and blue component and an optional alpha. All values are in the 0..255 integer range.

Hierarchy

  • Color

Index

Constructors

  • new Color(red: number, green: number, blue: number, alpha: number): Color
  • Create a new color.

    Parameters

    • red: number

      the red component of the color (0..255).

    • green: number

      the green component of the color (0..255).

    • blue: number

      the blue component of the color (0..255).

    • alpha: number

      the alpha (transparency) component of the color (0..255, where 255 is opaque).

    Returns Color

Properties

alpha: number

The alpha (transparency) component of the color (0..255, where 255 is opaque)

blue: number

The blue component of the color (0..255)

green: number

The green component of the color (0..255)

red: number

The red component of the color (0..255)

TYPE: string = "O"

The type of objects in this class

Methods

  • Make a copy of this instance.

    Returns Color

    returns a copy

  • toString(): string
  • Convert the object to a string.

    Returns string

    the string form of the object.

  • toStringARGB(): string
  • Convert the color to an A.R.G.B string.

    Returns string

    the string.

  • toStringRGB(): string
  • Convert the color to an R.G.B string.

    Returns string

    the string.

  • toStringRGBA(): string
  • Convert the color to an R.G.B.A string.

    Returns string

    the string.

  • fromRGB(red: number, green: number, blue: number): Color
  • Create a new RGB color.

    Parameters

    • red: number

      the red component of the color (0..255).

    • green: number

      the green component of the color (0..255).

    • blue: number

      the blue component of the color (0..255).

    Returns Color

    the color.

  • fromRGBA(red: number, green: number, blue: number, alpha: number): Color
  • Create a new RGBA color.

    Parameters

    • red: number

      the red component of the color (0..255).

    • green: number

      the green component of the color (0..255).

    • blue: number

      the blue component of the color (0..255).

    • alpha: number

      the alpha (transparency) component of the color (0..255, where 255 is opaque).

    Returns Color

    the color.