You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.7 KiB

4 years ago
  1. # is-color-stop
  2. Check if a string is CSS color stop
  3. [![NPM version](https://img.shields.io/npm/v/is-color-stop.svg?style=flat)](https://npmjs.org/package/is-color-stop)
  4. [![Build Status](https://img.shields.io/travis/pigcan/is-color-stop.svg?style=flat)](https://travis-ci.org/pigcan/is-color-stop)
  5. [![Coverage Status](https://img.shields.io/coveralls/pigcan/is-color-stop.svg?style=flat)](https://coveralls.io/r/pigcan/is-color-stop)
  6. [![NPM downloads](http://img.shields.io/npm/dm/is-color-stop.svg?style=flat)](https://npmjs.org/package/is-color-stop)
  7. [![Dependency Status](https://david-dm.org/pigcan/is-color-stop.svg)](https://david-dm.org/pigcan/is-color-stop)
  8. ## Install
  9. ```shell
  10. $ npm install is-color-stop
  11. ```
  12. ## Usage
  13. ```js
  14. const isColorStop = require('is-color-stop');
  15. isColorStop('yellow') // true
  16. isColorStop('yellow', '12px') // true
  17. isColorStop('yellow', 'calc(100%)') // true
  18. isColorStop('yellow', 'px') // false
  19. isColorStop.isColor('red') // true
  20. isColorStop.isColor('rgb(255)') // false
  21. isColorStop.isRGB('rgb(255, 0, 0)') // true
  22. isColorStop.isRGB('rgb(255)') // false
  23. isColorStop.isRGBA('rgba(255, 0, 0, .8)') // true
  24. isColorStop.isRGBA('rgba(255, 0, 0)') // false
  25. isColorStop.isHSL('hsl(123, 45%, 67%)') // true
  26. isColorStop.isHSL('hsl(123, 45%)') // false
  27. isColorStop.isHSLA('hsla(123, 45%, 67%, 0.4)') // true
  28. isColorStop.isHSLA('hsla(123, 45%, 67%)') // false
  29. isColorStop.isHex('#fff') // true
  30. isColorStop.isHex('#ff') // false
  31. isColorStop.isCSSColorName('tomato') // true
  32. isColorStop.isCSSColorName('hoge') // false
  33. isColorStop.isCSSLengthUnit('px') // true
  34. isColorStop.isCSSLengthUnit('x') // false
  35. isColorStop.isTransparent('transparent') // true
  36. ```
  37. ## License
  38. The MIT License (MIT)
  39. Copyright (c) 2017 Pigcan