Skip to main content

Function: normalizeMarkupColor()

normalizeMarkupColor(value, fallback?): string

Defined in: Data/Core/Colors.ts:75

Normalise a stored colour to canonical #RRGGBB.

Accepts, in order of preference:

  • v2 hex (#RRGGBB) — returned upper-cased
  • short hex (#RGB) — expanded
  • v1 palette name (yellow, …) — mapped via HIGHLIGHT_COLOR_HEX

COMPAT (v1 fallback, Pass 2 deletion point): the palette-name branch exists only because shipped user databases still hold literal names. Once a user-DB migration rewrites user_text_markup.color to hex, that branch and isHighlightColorName can go.

Parameters

value

unknown

The stored colour value

fallback?

string = HIGHLIGHT_COLOR_HEX.yellow

Returned when value is unrecognised (default: yellow hex)

Returns

string