Options
All
  • Public
  • Public/Protected
  • All
Menu

Class RGBASpace

Hierarchy

  • default
    • RGBASpace

Index

Constructors

Properties

converter: default<RGBAColorSpace>
type: "rgb"

Methods

  • Retrieves a color channel from the color model via key.

    example

    Here's a simple example retrieving each channel of the RGBA space

    rgb.toString() // rgb(0,128,255)
    rgb.color('red') // 0
    rgb.color('green') // 128
    rgb.color('blue') // 255

    Parameters

    • color: keyof RGBAColorSpace

      the name of the channel from the current color space to retrieve

    Returns number

    the value of the channel matching the provided key

  • toHexString(removeHashtag?: boolean): string
  • Returns a hex string representing the RGB color space. This ignores any alpha values.

    Example

    color.toString() // rgb(185,130,91)
    color.toHexString() // #b9825b
    color.toHexString(true) // b9825b

    Parameters

    • Optional removeHashtag: boolean

      will return the hex value without a hashtag if true, otherwise will return with hashtag

    Returns string

  • Returns this color space model. This record contains named channels and their corresponding values.

    Returns RGBAColorSpace

    the color model record

  • red(): number
  • Retrieves the value of the red channel for the current color space.

    Returns number

    the red channel value of this color space

  • green(): number
  • Retrieves the value of the green channel for the current color space.

    Returns number

    the green channel value of this color space

  • alpha(): number
  • Retrieves the value of the alpha channel for the current color space.

    Returns number

    the alpha channel value of this color space

  • blue(): number
  • Retrieves the value of the blue channel for the current color space.

    Returns number

    the blue channel value of this color space

  • toArray(): [number, number, number, number]
  • Retrieves an array representing the RGBA color space containing the primary colors and alpha values. Array index is ordered logically [RGBA].

    Returns [number, number, number, number]

    the RGBA color space values as an array

  • toString(alpha?: boolean): string

Generated using TypeDoc