Skip to content

Documentation / @ripl/3d / resolveColor

Function: resolveColor() ​

resolveColor(value): ColorRGBA | undefined

Defined in: 3d/src/core/color.ts:37

Parses a CSS colour into 0–255 RGBA channels, caching the result.

Light and material colours are resolved once per frame per surface, and parseColor is a regex match plus allocation — this keeps the shading path off it.

Parameters ​

ParameterTypeDescription
valuestringAny colour string @ripl/core can parse.

Returns ​

ColorRGBA | undefined

The parsed colour, or undefined when value is not a colour.