tamaki.mes.utils.colorClassToVar
Description
Converts a colour CSS class name into a CSS custom-property expression that can be used directly as a
style value. A bare class such as "neutral-100" becomes "var(--neutral-100)". A value that
already starts with -- is wrapped as var(--...), and a value that is already a var(...)
expression is returned unchanged.
Syntax
tamaki.mes.utils.colorClassToVar(color)
Parameters
| Parameter | Type | Nullable | Description |
|---|---|---|---|
color | String | False | The colour CSS class name (for example neutral-100). |
Returns
A String CSS var(--...) expression.
Code Examples
# In a binding script transform: convert a colour class to a CSS var() value
return tamaki.mes.utils.colorClassToVar(value)
# "neutral-100" -> "var(--neutral-100)"
# "var(--primary)" -> "var(--primary)" (returned unchanged)