Creates an instance of RGB.
Red component (0-255).
Green component (0-255).
Blue component (0-255).
Alpha component (0-1), defaults to 1.
Returns the RGB color as an array.
An array containing the red, green, blue, and alpha components.
Returns the RGB color as a hexadecimal string.
A string representation of the RGB color in hexadecimal format.
Returns the RGB color as a string.
A string representation of the RGB color in either rgb
or rgba
format.
Adjusts the brightness of the RGB color.
The brightness value to apply.
A new RGB instance with the adjusted brightness.
Adjusts the contrast of the RGB color.
The contrast value to apply.
A new RGB instance with the adjusted contrast.
Darkens the RGB color.
The ratio to darken the color by.
A new RGB instance with the darkened color.
Fades the RGB color by reducing its alpha value.
The fade value to apply.
A new RGB instance with the faded color.
Adjusts the gamma of the RGB color.
The gamma value to apply.
A new RGB instance with the adjusted gamma.
Lightens the RGB color.
The ratio to lighten the color by.
A new RGB instance with the lightened color.
Rotates the hue of the color by a given offset.
The amount to rotate the hue.
A new HSL color with the hue rotated.
Rounds the RGB color components to the nearest integer.
A new RGB instance with rounded color values.
Saturates the color by a given ratio.
The ratio to saturate the color.
A new HSL color with increased saturation.
Sets the hue of the color.
The new hue value.
A new HSV color with the hue set.
Static
parse
Represents an RGB color with optional alpha transparency.