[29741] | 1 | # Spectrum
|
---|
| 2 | ## The No Hassle Colorpicker
|
---|
| 3 |
|
---|
| 4 | See the demo and docs: http://bgrins.github.io/spectrum.
|
---|
| 5 |
|
---|
| 6 | I wanted a colorpicker that didn't require images, and that had an API that made sense to me as a developer who has worked with color in a number of applications. I had tried a number of existing plugins, but decided to try and make a smaller, simpler one.
|
---|
| 7 |
|
---|
| 8 | I started using canvas, then switched to CSS gradients, since it turned out to be easier to manage, and provided better cross browser support.
|
---|
| 9 |
|
---|
| 10 | ### Basic Usage
|
---|
| 11 |
|
---|
| 12 | Head over to the [docs](http://bgrins.github.io/spectrum) for more information. There is a visual demo of the different options hosted at: http://bgrins.github.io/spectrum.
|
---|
| 13 |
|
---|
| 14 | <script src='spectrum.js'></script>
|
---|
| 15 | <link rel='stylesheet' href='spectrum.css' />
|
---|
| 16 |
|
---|
| 17 | <input id='colorpicker' />
|
---|
| 18 |
|
---|
| 19 | <script>
|
---|
| 20 | $("#colorpicker").spectrum({
|
---|
| 21 | color: "#f00"
|
---|
| 22 | });
|
---|
| 23 | </script>
|
---|
| 24 |
|
---|
| 25 | ### jQuery Plugin Repository
|
---|
| 26 |
|
---|
| 27 | Spectrum is registered as a jQuery plugin on the jQuery plugin repository here: http://plugins.jquery.com/spectrum/
|
---|
| 28 |
|
---|
| 29 | ### Bower
|
---|
| 30 |
|
---|
| 31 | Spectrum is registered as a package with [Bower](http://bower.io/), so it can be pulled down using:
|
---|
| 32 |
|
---|
| 33 | bower install spectrum
|
---|
| 34 |
|
---|
| 35 | ### Continuous Integration
|
---|
| 36 |
|
---|
| 37 | [![Build Status](https://secure.travis-ci.org/bgrins/spectrum.png?branch=master)](http://travis-ci.org/bgrins/spectrum)
|
---|
| 38 |
|
---|
| 39 | Visit https://travis-ci.org/bgrins/spectrum to view the status of the automated tests.
|
---|
| 40 |
|
---|
| 41 | ### Building Spectrum Locally
|
---|
| 42 |
|
---|
| 43 | If you'd like to download and use the plugin, head over to http://bgrins.github.io/spectrum/ and click the 'Download Zip' button.
|
---|
| 44 |
|
---|
| 45 | If you'd like to run the development version, spectrum uses Grunt to automate the testing, linting, and building. Head over to http://gruntjs.com/getting-started for more information. First, clone the repository, then run:
|
---|
| 46 |
|
---|
| 47 | npm install -g grunt-cli
|
---|
| 48 | npm install
|
---|
| 49 |
|
---|
| 50 | # runs jshint and the unit test suite
|
---|
| 51 | grunt
|
---|
| 52 |
|
---|
| 53 | # runs jshint, the unit test suite, and builds a minified version of the file.
|
---|
| 54 | grunt build
|
---|
| 55 |
|
---|
| 56 | ### Internationalization
|
---|
| 57 |
|
---|
| 58 | If you are able to translate the text in the UI to another language, please do! You can do so by either [filing a pull request](https://github.com/bgrins/spectrum/pulls) or [opening an issue]( https://github.com/bgrins/spectrum/issues) with the translation. The existing languages are listed at: https://github.com/bgrins/spectrum/tree/master/i18n.
|
---|
| 59 |
|
---|
| 60 | For an example, see the [Dutch translation](i18n/jquery.spectrum-nl.js).
|
---|