项目原始demo,不改动
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.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. # colormin [![Build Status](https://travis-ci.org/ben-eb/colormin.svg?branch=master)][ci] [![NPM version](https://badge.fury.io/js/colormin.svg)][npm] [![Dependency Status](https://gemnasium.com/ben-eb/colormin.svg)][deps]
  2. > Turn a CSS color into its smallest representation.
  3. ## Install
  4. With [npm](https://npmjs.org/package/colormin) do:
  5. ```
  6. npm install colormin --save
  7. ```
  8. ## Example
  9. ```js
  10. var colormin = require('colormin');
  11. console.log(colormin('rgba(255, 0, 0, 1)'));
  12. // => 'red'
  13. ```
  14. colormin works for rgb, rgba, hsl, hsla, hex & css color keywords. See more
  15. example output in the [tests](src/__tests__/index.js). Note that colormin does
  16. not convert invalid CSS colors, as it is not a color validator.
  17. ## API
  18. ### colormin(color, [options])
  19. #### color
  20. Type: `string`
  21. The color to minify.
  22. #### options
  23. ##### legacy
  24. Type: `boolean`
  25. Default: `false`
  26. Set this to `true` to enable IE < 10 compatibility; the browser chokes on the
  27. `transparent` keyword, so in this mode the conversion from `rgba(0,0,0,0)`
  28. is turned off.
  29. ## Contributing
  30. Pull requests are welcome. If you add functionality, then please add unit tests
  31. to cover it.
  32. ## License
  33. MIT © [Ben Briggs](http://beneb.info)
  34. [ci]: https://travis-ci.org/ben-eb/colormin
  35. [deps]: https://gemnasium.com/ben-eb/colormin
  36. [npm]: http://badge.fury.io/js/colormin