https://github.com/component/color-parser
CSS color string parser
https://github.com/component/color-parser
Last synced: 8 months ago
JSON representation
CSS color string parser
- Host: GitHub
- URL: https://github.com/component/color-parser
- Owner: component
- Created: 2012-09-12T16:29:23.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2019-07-10T18:03:48.000Z (over 6 years ago)
- Last Synced: 2024-05-08T17:16:37.771Z (almost 2 years ago)
- Language: JavaScript
- Size: 155 KB
- Stars: 18
- Watchers: 7
- Forks: 8
- Open Issues: 2
-
Metadata Files:
- Readme: Readme.md
- Changelog: History.md
Awesome Lists containing this project
README
# color-parser
CSS color string parser
## Installation
$ component install component/color-parser
### Example
```js
var parse = require('color-parser');
parse('#fc0')
// => { r: 255, g: 204, b: 0, a: 1 }
parse('#ffcc00')
// => { r: 255, g: 204, b: 0, a: 1 }
parse('rgb(255, 204, 0)')
// => { r: 255, g: 204, b: 0, a: 1 }
parse('rgba(255, 204, 0, 1)')
// => { r: 255, g: 204, b: 0, a: 1 }
```
# License
MIT