Function: getCssVariable()
ts
function getCssVariable(key, ele?): string;Gets the value of a CSS variable on the specified element or the root element.
Parameters
| Parameter | Type | Description |
|---|---|---|
key | string | The name of the CSS variable to get. |
ele? | HTMLElement | The element to get the CSS variable from. If not specified, defaults to the root element. |
Returns
string
The value of the CSS variable.
Example
ts
setCssVariable('--test-color', 'red')
console.log(getCssVariable('--test-color'))Since
1.0.0