Skip to content

Instantly share code, notes, and snippets.

View dutchcelt's full-sized avatar

Egor Kloos dutchcelt

View GitHub Profile
@dutchcelt
dutchcelt / globalCssVar.js
Last active March 15, 2024 08:14
Add global CSS custom properties
/**
* Global CSS Variable Object
* This object provides a convenient way to manage global CSS variables.
* @example globalCssVar.style = "--color: rebeccapurple";
* @example globalCssVar.style = ["--weight: 100;", "--size: 4rem;"];
*
* @type {object}
* @property {CSSStyleRule} cssRule - CSSStyleRule for managing global Custom Properties.
* @property {(type: string) => void} addProp - add global CSS properties
* @property {CSSStyleDeclaration} style - Getter/Setter for CSSStyleDeclaration