Theme variable
Syntax
themeVar("my-var")
Description
Looks up the value of a variable that is defined in the current theme. A theme can define colors, icons and dimensions, among other things. In a CSS file, a theme variable my-var is available via the expression var(--my-var). The same variable can be evaluated via TL script using the expression themeVar("my-var").
Parameters
| Theme name | Name Type | Type Description | Mandatory | Default |
|---|---|---|---|---|
var |
String | The name of the variable to be looked up | Yes | - |
Return value
Type: Depending on the variable, string, color value, icon.
The value with which the given variable is assigned in the current theme.
Examples
Example 1: Output
themeVar("background-danger")
Output: The color value with which the background of values annotated with the CSS class tl-danger is filled.