var-css

2.0.0 • Public • Published

Var Css️

With Npm

npm install var-css --save

Or with Yarn

yarn add var-css

Usage

import varCss from 'var-css'
 
// Get a string with the current value
varCss.get('--primary-color')
 
// Set a new value
varCss.set('--secondary-color', '#40eeff')

Source code

If you don't want to include the library, you can copy and paste the source code:

const varCss = {
   get: function(name) {
      return getComputedStyle(document.documentElement).getPropertyValue(name)
   },
   set: function(name, newValue) {
      document.documentElement.style.setProperty(name, newValue)
   }
}

* The bundled library has support for ES5.

Dependents (0)

Package Sidebar

Install

npm i var-css

Weekly Downloads

2

Version

2.0.0

License

MIT

Unpacked Size

1.48 kB

Total Files

3

Last publish

Collaborators

  • damiandelio