color
color
Last modified: 03 January 2025
This type is a color used within the rendering system.
Do not mistake this type with color
that is used in game! While these types are interchangeable internally, they are NOT in the API.
__call
Creates a new color instance.
Arguments
1. Default color (translucent black).
None.
2. Integer colors.
Name
Type
Description
r
int
Red color (0
to 255
).
g
int
Green color (0
to 255
).
b
int
Blue color (0
to 255
).
a
int
Opacity (0
to 255
). Defaults to 255
.
3. Hex string.
Name
Type
Description
hex
string
Hex string. Formats are: #rrggbbaa
, #rrggbb
, #rgba
and #rgb
.
Returns
Type
Description
color
Color object.
Example
white
Returns a white, opaque color.
Arguments
None.
Returns
Type
Description
color
Color object.
Example
white_transparent
Returns a white, transparent color.
Arguments
None.
Returns
Type
Description
color
Color object.
Example
black
Returns a black, opaque color.
Arguments
None.
Returns
Type
Description
color
Color object.
Example
black_transparent
Returns a black, transparent color.
Arguments
None.
Returns
Type
Description
color
Color object.
Example
percent
Returns a red-to-green color, depending on the provided percent.
Arguments
Name
Type
Description
p
float
Percentile (0
to 1
).
a
float
Opacity. Defaults to 1
.
Returns
Type
Description
color
Color object.
Example
gray
Returns a black-to-white color, depending on the provided percent.
Arguments
Name
Type
Description
b
float
Percentile (0
to 1
).
a
float
Opacity. Defaults to 1
.
Returns
Type
Description
color
Color object.
Example
interpolate
Interpolates two colors.
Arguments
Name
Type
Description
a
color
Starting color.
b
color
Ending color.
t
float
Interpolation percentile.
Returns
Type
Description
color
Color object.
Example
rgba
Returns integer representation of this color (RGBA format)
Arguments
None.
Returns
Type
Description
int
RGBA color.
Example
argb
Returns integer representation of this color (ARGB format)
Arguments
None.
Returns
Type
Description
int
ARGB color.
Example
bgra
Returns integer representation of this color (BGRA format)
Arguments
None.
Returns
Type
Description
int
BGRA color.
Example
abgr
Returns integer representation of this color (ABGR format)
Arguments
None.
Returns
Type
Description
int
ABGR color.
Example
darken
Returns darker variant of this color.
Arguments
Name
Type
Description
value
float
Modulation amount (0
to 1
).
Returns
Type
Description
color
Darker color.
Example
mod_a
Modulate opacity of the color. This will take existing opacity, and multiply it by whatever value you provide. It is useful if you want to modulate same color in steps, instead of setting the accurate opacity number.
Arguments
1. Float variant.
Name
Type
Description
value
float
Opacity modulation (0
to 1
).
2. Integer variant.
Name
Type
Description
value
int
Opacity modulation (0
to 255
).
Returns
Type
Description
color
Modulated color.
Example
r
Override red and return new color.
Arguments
Name
Type
Description
value
float
New value.
Returns
Type
Description
color
New color.
Example
g
Override green and return new color.
Arguments
Name
Type
Description
value
float
New value.
Returns
Type
Description
color
New color.
Example
b
Override blue and return new color.
Arguments
Name
Type
Description
value
float
New value.
Returns
Type
Description
color
New color.
Example
a
Override opacity and return new color.
Arguments
Name
Type
Description
value
float
New value.
Returns
Type
Description
color
New color.
Example
get_r
Returns red color value.
Arguments
None.
Returns
Type
Description
int
Color value.
Example
get_g
Returns green color value.
Arguments
None.
Returns
Type
Description
int
Color value.
Example
get_b
Returns blue color value.
Arguments
None.
Returns
Type
Description
int
Color value.
Example
get_a
Returns opacity color value.
Arguments
None.
Returns
Type
Description
int
Color value.
Example
h
Return hue value of the color.
Arguments
None.
Returns
Type
Description
int
Hue (0
to 359
).
Example
s
Returns saturation value of the color.
Arguments
None.
Returns
Type
Description
float
Saturation (0
to 1
).
Example
v
Returns brightness value of the color.
Arguments
None.
Returns
Type
Description
float
Brightness (0
to 1
).
Example
hsv
Construct new color from provided HSB values.
Arguments
Name
Type
Description
hue
int
Hue (0
to 359
).
saturation
float
Saturation (0
to 1
).
brightness
float
Brightness (0
to 1
).
alpha
float
Override opacity of the source color. Must be either left out, or provided 0
to 1
value.
Returns
Type
Description
color
New color.
Example
Last updated