Class "Color"⚓︎
Constructors⚓︎
Color ()⚓︎
Color Color ( float R, float G, float B, float A = 1, float RO = 0, float GO = 0, float BO = 0 )⚓︎
Constructor for the "Color" class.
When using the Font class, use KColor() instead.
Colors are made of three separate components, tint, colorize and offset. Tint acts like a color multiplicator. Offset is a color which is added after the tint is applied. Colorize is complicated. See the SetColorize()
function for a detailed description.
R, G, B, A, RO, GO and BO accept numbers between 0 and 1.
Operators⚓︎
__mul ()⚓︎
Color __mul ( Color right )⚓︎
Defines the multiplication of two Color objects using the *
operator.
Constants⚓︎
Color.Default⚓︎
Functions⚓︎
Lerp ()⚓︎
static Color Lerp ( Color m1, Color m2, float t )⚓︎
Linear Interpolation between two colors. t
is the "progress" of the interpolation. Setting t = 0.5
means that the color in the middle of m1 and m2 will be returned.
Reset ()⚓︎
void Reset ( )⚓︎
Set·Colorize ()⚓︎
void SetColorize ( float Red, float Green, float Blue, float Amount )⚓︎
The colorize function can be used to change the color of sprites. Its the best for that purpose, since it does not affect existing coloranimations like the flashing of creep.
The values can be between 0 and 1 for normal coloration. if you use higher numbers the color gets more vibrant.
Notes
The alpha component determines how much colorization must be applied. The function takes the original color, converts it to grayscale, multiplies it by the RGB components and then blends it back with the original color. The alpha value determines the blending factor. Colorization is applied after the tint and before the offset function.
Example Code
SetColorize(1, 1, 1, 1)
will turn the sprite into grayscale.SetColorize(1, 0, 0, 1)
will turn it red but not as a red tint but as shades of red.SetColorize(1, 1, 1, 2)
will invert the sprite without touching its luminosity.
This code changes the color of red Creep to be purple
1 2 3 4 5 6 7 8 |
|
Set·Offset ()⚓︎
void SetOffset ( float RedOffset, float GreenOffset, float BlueOffset )⚓︎
Offset is a color that gets added to the sprite after the Tint was applied.
Set·Tint ()⚓︎
void SetTint ( float RedTint, float GreenTint, float BlueTint, float AlphaTint )⚓︎
Tint acts like a color multiplicator.
Variables⚓︎
A⚓︎
float A⚓︎
Alpha value of the color, where 0 is fully transparent, 1 is fully opaque.
B⚓︎
float B⚓︎
Blue value of the color. Number between 0 and 1.
BO⚓︎
float BO⚓︎
Blue-Offset value of the color. Number can be positive or negative.
G⚓︎
float G⚓︎
Green value of the color. Number between 0 and 1.
GO⚓︎
float GO⚓︎
Green-Offset value of the color. Number can be positive or negative.
R⚓︎
float R⚓︎
Red value of the color. Number between 0 and 1.
RO⚓︎
float RO⚓︎
Red-Offset value of the color. Number can be positive or negative.