resolveQrColor

QrCode
stable

Resolve a QR code colour value (intent token or raw colour) to a concrete CSS colour string for a foreground or background role. Falls back to a provided default for empty/null inputs.

API

Signature

Full TypeScript signature sourced from the util file.

typescript

API

Parameters

Input parameters accepted by this util.

value
required
TColor | undefined | null
The colour value to resolve. An intent string is mapped to its foreground or background token depending on role; a raw string is used directly; null/undefined/empty returns the fallback.
role
required
'foreground' | 'background'
Determines which token to use for intent strings: 'foreground' maps to fg-subtle, 'background' maps to the intent background token.
fallback
required
string
Default CSS colour string returned when value is null, undefined, or empty.

API

Return value

The value returned by this util.

The resolved CSS colour string (intent token var or raw value) or the fallback string.

Usage

Examples

Ready-to-paste usage snippets.

Resolve foreground and background colours

typescript