fromRGBA()

Color class method that returns an sRGB Color object with the specified values.

Syntax

To return an opaque sRGB Color object based on red, green, and blue values:

fromRGBA(r Numeric, g Numeric, b Numeric)

To return an sRGB Color object based on red, green, blue, and alpha values:

fromRGBA(r Numeric, g Numeric, b Numeric, a Numeric)

Parameters

  • r (red) is within the range (0.0 - 255)
  • g green) is within the range (0.0 - 255)
  • b (blue) is within the range (0.0 - 255)
  • a (alpha) is within the range (0.0 - 1.0)

Alpha defaults to 1.0 if not specified.

The color used depends on the best match from the colors available for the output device.

Usage

Class methods do not require a Color object instance. When you invoke a class method, it is prefixed with the Color class name and the '.' character.

Example

Color.fromRGBA(200,162,200)

This returns a Color object that is lilac and opaque.