1.3.0 • Published 7 years ago

unobuilder-style-to-object v1.3.0

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

:golf: Unobuilder Style to Object

Convert native CSS properties to unobuilder object

Install

Using NPM:
npm install unobuilder-style-to-object

Using Yarn:
yarn add unobuilder-style-to-object

Usage

Native CSS Properties are object that should be generated from getComputedStyle

import cssToProps from 'unobuilder-style-to-object'

const nativeProps = window.getComputedStyle(document.querySelector('#my-element'))
const cssProps = cssToProps(nativeProps)

console.log(cssProps)
/*
{
  backgroundColor: {
    value: {
      hsl: {
        h:0,
        s:0,
        l:0,
        a:1
      },
      hex: '#000000',
      rgba: {
        r:0,
        g:0,
        b:0,
        a:1
      },
      hsv: {
        h:0,
        s:0,
        v:0,
        a:1
      },
      oldHue: 0
      source: 'rgb',
      a:1
    }
  },
  display: {
    value: 'block'
  },
  width: {
    value: 10,
    unit: 'px'
  }
}
*/

License

MIT © djavaweb

1.3.0

7 years ago

1.2.0

7 years ago

1.1.0

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago