2.0.0 • Published 4 years ago

var-css v2.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

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.