https://github.com/matype/is-color
Check if a string is CSS color value
https://github.com/matype/is-color
Last synced: over 1 year ago
JSON representation
Check if a string is CSS color value
- Host: GitHub
- URL: https://github.com/matype/is-color
- Owner: matype
- License: other
- Created: 2015-07-24T10:24:46.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2018-07-17T09:57:46.000Z (about 8 years ago)
- Last Synced: 2024-06-01T06:12:53.817Z (about 2 years ago)
- Language: JavaScript
- Size: 15.6 KB
- Stars: 17
- Watchers: 2
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# is-color [](https://travis-ci.org/morishitter/is-color)
Check if a string is CSS color value
## Install
```shell
$ npm install is-color
```
## Usage
```js
var isColor = require('is-color')
isColor('rgb(255, 0, 0)') // true
isColor('rgb(255)') // false
isColor('rgba(255, 0, 0, .8)') // true
isColor('rgba(255, 0, 0)') // false
isColor('hsl(123, 45%, 67%)') // true
isColor('hsl(123, 45%)') // false
isColor('hsla(123, 45%, 67%, 0.4)') // true
isColor('hsla(123, 45%, 67%)') // false
isColor('#fff') // true
isColor('#ff') // false
isColor('tomato') // true
isColor('hoge') // false
isColor('currentColor') // true
isColor('inherit') // true
isColor('transparent') // true
```
## License
The MIT License (MIT)
Copyright (c) 2015 - 2018 Masaaki Morishita