Color represents an RGBA color with four uint8 components - r, g,
b, a, each in the range 0–255. Every render function, ESP element,
and visual effect uses this type.
The default alpha is 255 (fully opaque). A freshly constructed
new Color() is white (255, 255, 255, 255), not transparent.Overview
Creating colors
RGBA, hex, arrays, objects, HSV, HSL, and float forms.
Arithmetic
Add, subtract, scale - all return new instances.
Modification
Alpha override, brightness, and interpolation.
Conversion
HSV, packed integers, arrays, and string output.
Presets
Built-in white, black, red, green.
Properties
Creating colors
Seven forms - pick whatever fits your data source.Constructor
255.
- RGBA numbers
- Hex integer
- Array
- Object
Color.fromHex
"#FF0000", "FF0000FF") or a
packed hex integer.
Color.fromHSV
1.0.
Color.fromHSL
1.0.
Color.fromFloat
0–1 range.
Alpha defaults to 1.0.
Presets
Static factories for common colors. All return a new Color instance with alpha255.
Arithmetic
All arithmetic methods return a new Color. Components are clamped to0–255 internally.
add
0–255.
sub
0–255.
mul
Modification
These methods create variations of a color - adjusting alpha, brightness, or blending with another color. All return a new Color.withAlpha
0–255 integer
or a 0.0–1.0 float.
The engine auto-detects: if the value is a float in
[0.0, 1.0] (and
not an integer), it’s treated as a fraction. Otherwise it’s a byte.
brightness
factor. A factor of 0.5 halves the
brightness, 2.0 doubles it. Alpha is unchanged. Returns a new Color.
lerp
other. t=0 returns this
color, t=1 returns other, t=0.5 returns the midpoint. All four
channels (including alpha) are interpolated.
- Health color
- Smooth transition
- Alert flash
Conversion
toHSV
toRGBA
toARGB
toImU32
ImU32,
ABGR byte order). You rarely need this directly - render functions
accept Color objects natively.
equals
false if
other is not a Color.
clone
toArray
[r, g, b, a] as a plain array.
toString
Common patterns
- Health bar color
- Distance fade
- Rainbow cycle
- Team colors