Skip to main content

Function: cpkColor()

cpkColor(element, overrides?): string

Defined in: src/mobjects/chemistry/cpkColors.ts:70

Resolve the color for an element.

The lookup order is: caller overrides, then the CPK palette, then the default color. Overrides are matched case-insensitively: an override key in any case (e.g. 'cl' or 'CL') resolves to the same element as its canonical symbol ('Cl'), so an override is never silently ignored over a case mismatch.

Parameters​

element​

string

The element symbol (any case).

overrides?​

Record<string, string>

Optional per-element color overrides.

Returns​

string

The hex color string.