fromHSBA()

Color class method that returns a Color object based on specified values for the HSB color model.

Syntax

To return a Color object based on hue, saturation, and brightness:

Color.fromHSBA(h Numeric,s Numeric,b Numeric)

To return a Color object based on hue, saturation, brightness, and alpha:

Color.fromHSBA(h Numeric,s Numeric,b Numeric,a Numeric)

Parameters

  • h (hue) is any floating-point number. The floor of this number is subtracted from it to create a fraction between 0 and 1, which is then multiplied by 360.
  • s (saturation) is a floating-point value between zero and one (numbers within the range 0.0-1.0).
  • b (brightness) is a floating-point value between zero and one (numbers within the range 0.0-1.0).
  • a (alpha) is the alpha component, which specifies opacity.

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.fromHSBA(0.5,0.5,0.5,0.5)

This returns a Color object that is red and partially transparent.