# is-color

> Check if a string is CSS color value

Latest version **1.0.2** (published 2018-07-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install is-color
pnpm add is-color
yarn add is-color
bun add is-color
```

## Health

**Score 23/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2018-07-17 |
| First published | 2015-07-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/is-color) |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 13.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 17 |
| Author | Masaaki Morishita |
| Maintainers | morishitter |
| Keywords | css, color |

## Links

- npm: https://www.npmjs.com/package/is-color
- Repository: https://github.com/morishitter/is-color/git
- npm.io page: https://npm.io/package/is-color

## Dependencies (6)

- [hsl-regex](https://npm.io/package/hsl-regex.md) ^1.0.0
- [rgb-regex](https://npm.io/package/rgb-regex.md) ^1.0.1
- [hsla-regex](https://npm.io/package/hsla-regex.md) ^1.0.0
- [rgba-regex](https://npm.io/package/rgba-regex.md) ^1.0.0
- [css-color-names](https://npm.io/package/css-color-names.md) ^0.0.4
- [hex-color-regex](https://npm.io/package/hex-color-regex.md) ^1.1.0

## Alternatives

- [style-dictionary](https://npm.io/package/style-dictionary.md) — 2.0M weekly downloads
- [postcss-merge-idents](https://npm.io/package/postcss-merge-idents.md) — 1.7M weekly downloads
- [@fontsource/noto-sans](https://npm.io/package/@fontsource/noto-sans.md) — 93.0K weekly downloads
- [uglifycss](https://npm.io/package/uglifycss.md) — 71.6K weekly downloads
- [mat4-interpolate](https://npm.io/package/mat4-interpolate.md) — 23.3K weekly downloads

## Recent versions

- 1.0.2 (latest) — 2018-07-17
- 1.0.1 — 2018-05-01
- 1.0.0 — 2018-03-18
- 0.2.0 — 2015-07-25
- 0.1.0 — 2015-07-24

## README

# is-color [![Build Status](https://travis-ci.org/morishitter/is-color.svg)](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

---
_Source: https://npm.io/package/is-color · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
