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. # rgb-regex
  2. [![Build Status](https://secure.travis-ci.org/regexps/rgb-regex.png?branch=master)](https://travis-ci.org/regexps/rgb-regex)
  3. Regex for RGB color strings.
  4. ## Installation
  5. ```bash
  6. npm install --save rgb-regex
  7. ```
  8. ## Usage
  9. ```javascript
  10. var rgbRegex = require('rgb-regex');
  11. rgbRegex({ exact: true }).test('rgb(12, 34, 56)'); // => true
  12. rgbRegex({ exact: true }).test('unicorns'); // -> false
  13. rgbRegex({ exact: true }).test('rgb(,,)'); // => false
  14. rgbRegex().exec('rgb(12, 34, 56)');
  15. // => [
  16. // '12',
  17. // '34',
  18. // '56',
  19. // index: 0,
  20. // input: 'rgb(12,34,56)'
  21. // ]
  22. 'rgb(12, 34, 56) cats and dogs'.match(rgbRegex());
  23. // = ['rgb(12, 34, 56)']
  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).