Theming
/ API Reference
Theming
/ API Reference

createVariableReference

The Gist

import { createVariableReference } from '@weser/theming'

const [name, reference] = createVariableReference('brand-color', 'red')

// => '--brand-color'
console.log(name)

// => 'var(--brand-color, red)'
console.log(reference)

Parameters

ParameterTypeDescription
namestringThe CSS variable name
fallbackValuestring?The fallback value assigned to the CSS variable

Returns

([string, string]) A tuple where the first element is a string referencing the name of the CSS variable and the second element is a string referencing the CSS variable reference value.

On this page