An object which stores red, green, blue, and alpha values in instance variables, and provides numerous class and instance methods for creating and manipulating these values.
Create a new instance with float values.
An instance of Float between 0 and 1.
An instance of Float between 0 and 1.
An instance of Float between 0 and 1.
An instance of Float between 0 and 1.
Create a new instance from 8-bit integer values between 0 and 255.
An instance of Integer between 0 and 255.
An Integer between 0 and 255.
An Integer between 0 and 255.
An Integer between 0 and 255.
Same as Color.new(*array)
.
Creates a new instance from a hex color string.
A String.
The string should be a 6 character web color, or a 3 character CSS style color. A preceding # is optional.
Nothing is darker.
Nothing is lighter.
Nothing is more clear.
American shades of grey.
Shades between 0 (black) and 1 (white) as Float.
Transparency of gray between 0 and 1 as Float.
British shades of grey.
Shades between 0 (black) and 1 (white) as Float.
Transparency of grey between 0 and 1 as Float.
Create a new red, green, blue, cyan, magenta or yellow Color.
An instance of Float between 0 and 1, where 1 is the bright, fully saturated color, and 0 is black.
Transparency between 0 and 1 as Float.
A random RGB Color where the colors are randomly chosen between lo
and hi
. See *new.
An instance of Float between 0 and 1.
An instance of Float between 0 and 1.
Maps hsv and alpha values to rgb between 0 and 1.
Float between 0 and 0.999.
Float between 0 and 1.
Float between 0 and 1.
Float between 0 and 1.
Get/set one of the instance variables, red
, green
, blue
, or alpha
.
An instance of Float between 0 and 1.
Returns a String containing a 6 character web color code, preceded by a #.
Binary operator.
Returns a Color, where red
, green
, and blue
are scaled by the alpha
value, and alpha is set to 1.
Interpolates the red
, green
, blue
, and alpha
values of two Colors, linearly weighting between the first and the second.
A second Color.
0 means only this, while 1 means only that.
Returns a random variation of a Color.
Varies the RGB values +- this amount.
Low-clips the RGB variation here.
High-clips the RGB variation here.
Varies the alpha value +/- this amount, and clips it between 0 and 1.
Returns the complementary color.
An instance of Color.
A value between 0 and 1. Default value is 1.0.
An instance of Color.
A value between 0 and 1. Default value is 1.0.
An instance of Color.
A value between 0 and 1. Default value is 1.0.
An instance of Color.
A value between 0 and 1. Default value is 1.0.
An instance of Color.
A value between 0 and 1. Default value is 1.0.
An instance of Color.
A value between 0 and 1. Default value is 1.0.
An instance of Color.
A value between 0 and 1. Default value is 1.0.
An instance of Color.
A value between 0 and 1. Default value is 1.0.
An instance of Color.
A value between 0 and 1. Default value is 0.
An instance of Color.
A value between 0 and 1. Default value is 0.
An instance of Color.
A value between 0 and 1. Default value is 0.
Returns an array with [hue, saturation, value, alpha]
, as values between 0 and 1.
Returns an array with [red, green, blue, alpha]
, as values between 0 and 1.
Returns an array with [red, green, blue, alpha]
.
Round the color.