0–255. Global class, no import.
A plain number is always packed
0xAABBGGRR, red in the low byte.
Fields r, g, b, a take integers 0–255, anything else throws.ColorLike is a Color, a packed number, "#rgb", "#rgba", "#rrggbb", "#rrggbbaa", [r, g, b, a?] or { r, g, b, a? }.
Overview
Common
from, set, add, lerp…Creating
fromHex, fromRGB, fromHSV, red()…Adjusting
scale, withAlpha, withAlphaF, lerp.Converting
toHex, toABGR, toHSV…Common
Every argument takes anyColorLike, not just a Color.
Only
set() and normalize() change the value. Nothing changes its arguments.
Color has no mul, div or normalize. Channel math clamps instead of wrapping, and lerp clamps t to 0–1.
Creating
The constructor with no arguments is opaque white.fromHex
rgb, rgba, rrggbb or rrggbbaa, with or without #. Anything else throws TypeError.
fromHSV
0–1, alpha defaults to 1.
Adjusting
withAlpha
withAlpha takes 0–255, withAlphaF takes 0–1. Both clamp.