CSS Variables

This exposes getCSSVar and setCSSVar utility functions to get and set CSS variables easily.


Get CSS Variables easily

You don’t have to remember to use getComputedStyle and getPropertyValue to get CSS variables anymore. They’ve been packed into a single useful utility.

main.js
// Getting a CSS Variable
const value = getCSSVar('.selector', '--width')

Set CSS Variables easily

Likewise, no need to remember browser API for setting a CSS Variable too — everything has been made into an easy to use setCSSVar function for you.

main.js
// Setting a CSS Variable
setCSSVar('.selector', '--width', '100px')