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

Signature TypeScript complète, extraite du fichier util.

typescript

API

Paramètres

Paramètres d'entrée acceptés par cet util.

value
requis
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
requis
'foreground' | 'background'
Determines which token to use for intent strings: 'foreground' maps to fg-subtle, 'background' maps to the intent background token.
fallback
requis
string
Default CSS colour string returned when value is null, undefined, or empty.

API

Valeur de retour

La valeur retournée par cet util.

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

Usage

Exemples

Extraits de code prêts à coller.

Resolve foreground and background colours

typescript