classToHex
Commons
stable
Resolves a named colour class string (e.g. "red lighten-2") to its hex value by looking it up in a colour map. Returns an empty string when the colour is not found.
API
Signature
Signature TypeScript complète, extraite du fichier util.
API
Paramètres
Paramètres d'entrée acceptés par cet util.
- colorrequisstring
- A colour class name in the form "colorName modifier" (e.g. "red lighten-2") or just "colorName" for the base shade.
- colorsrequisRecord<string, Record<string, string>>
- A nested map of colour-name → modifier → hex string. The origam colour palette is the default source.
API
Valeur de retour
La valeur retournée par cet util.
- The resolved hex string, or an empty string when the colour name or modifier is not found.
Usage
Exemples
Extraits de code prêts à coller.
Resolve a colour class to hex