Color4
Represents a color in RGBA space (with alpha for transparency).
Fields
The red component (0–255).
The green component (0–255).
The blue component (0–255).
The alpha component (0–255).
Properties
The red component of the color, in the range [0.0, 1.0].
The green component of the color, in the range [0.0, 1.0].
The blue component of the color, in the range [0.0, 1.0].
The alpha (opacity) component of the color, in the range [0.0, 1.0].
Functions
Converts the color to a 32-bit unsigned integer in RGBA format.
Returns: The color as a 32-bit unsigned integer in RGBA format.
Creates a Color from HSV (Hue, Saturation, Value) components.
- hue
- The hue component, in the range [0.0, 1.0].
- saturation
- The saturation component, in the range [0.0, 1.0].
- value
- The value component, in the range [0.0, 1.0].
- transparency
- The transparency component, in the range [0.0, 1.0].
Returns: The resulting Color.
Converts the color to a hexadecimal (HTML) string representation.
Returns: The hexadecimal string representation of the color, in the format RRGGBBAA.
Sets this color's components from a hexadecimal string (with or without a leading #).
- hex
- A 6- or 8-character hex string (RRGGBB or RRGGBBAA).
Returns: This color, with components updated to match .
Creates a Color from a hexadecimal string (with or without a leading #).
- hex
- A 6-character RRGGBB hex string.
Returns: The resulting Color.
Sets this color from HSV (Hue, Saturation, Value) components.
- hue
- The hue component, in the range [0.0, 1.0].
- saturation
- The saturation component, in the range [0.0, 1.0].
- value
- The value component, in the range [0.0, 1.0].
- transparency
- The transparency component, in the range [0.0, 1.0].
Returns: This color, with components updated to match the HSV input.
Randomizes this color's RGB components.
Returns: This color, with randomized components.