color_t
color_t represents a color with red, green, blue, and alpha components. It also supports rainbow colors with customizable speed.
Declaration:
class color_t
{
// all R, G, B, and A components are 0f to 1f
// examples:
// 255 = 1f
// YOUR RGB / 255f
float r;
float g;
float b;
float a;
float rainbow_speed; // 1-10 are typical values
bool rainbow; // controls whether this color is rainbow cycled
}
Constructors:
// while the "r, g, b, a" fields are 0-1 floats, constructors accept
// normal RGBA values ex. 255, 255, 255, 255
color_t(int r, int g, int b, int a) // standard constructor
color_t{int r, int g, int b, int a} // initializer list style
Last updated
Was this helpful?