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.

51 lines
1.1 KiB

4 years ago
  1. # hsl-regex
  2. [![Build Status](https://secure.travis-ci.org/regexps/hsl-regex.png?branch=master)](https://travis-ci.org/regexps/hsl-regex)
  3. Regex for matching HSL colors.
  4. ## Installation
  5. ```bash
  6. npm install --save hsl-regex
  7. ```
  8. ## Usage
  9. ```javascript
  10. var hslRegex = require('hsl-regex');
  11. hslRegex({ exact: true }).test('hsl(123, 45%, 67%)'); // => true
  12. hslRegex({ exact: true }).test('foo bar'); // => false
  13. hslRegex({ exact: true }).exec('hsl(1, 1.111%, 1.1111%)');
  14. // => [
  15. // 'hsl(1, 1.111%, 1.1111%)',
  16. // '1',
  17. // '1.111%',
  18. // '1.1111%',
  19. // index: 0,
  20. // input: 'hsl(1, 1.111%, 1.1111%)'
  21. // ]
  22. 'hsl(123, 45%, 67%) cats and dogs'.match(hslRegex());
  23. // = ['hsl(123, 45%, 67%)']
  24. ```
  25. ## License
  26. MIT
  27. ## Contributing
  28. 1. Fork it
  29. 2. Create your feature branch (`git checkout -b my-new-feature`)
  30. 3. Commit your changes (`git commit -am 'Add some feature'`)
  31. 4. Push to the branch (`git push origin my-new-feature`)
  32. 5. Create new Pull Request
  33. Crafted with <3 by John Otander ([@4lpine](https://twitter.com/4lpine)).
  34. ***
  35. > This package was initially generated with [yeoman](http://yeoman.io) and the [p generator](https://github.com/johnotander/generator-p.git).