avp / spectra

A Javascript color library. Quickly manipulate and convert colors.
avp.github.io/spectra
MIT License
237 stars 18 forks source link

Add harmony function. #12

Closed benjamminf closed 10 years ago

benjamminf commented 10 years ago

Added harmony method to API. Tests for all cases provided in the tester.js file. Based off the link provided in the issues section (goo.gl/R3FRlU).

Examples.

I want to generate the two analogous colours either side of my chosen colour:

var analogous = Spectra('#ff00ff').harmony('analogous', 1);

The first argument, 'analgous' is fairly self explanatory. The second, 1 indicates the index in which the original color appears in the resulting list of harmonious colors. Calling with analogous will produce two analogous colors and the original color. Indicating that the original color be at the first index, it will then generate the two colors to the left (zeroth index) and the right (second index). If I were to specify 0 or 2, it will produce two analogous colors to the left or to the right. This indexing system works for all types.

avp commented 10 years ago

Your code didn't pass JSHint. Make sure to run grunt test before submitting a pull request.

Put line breaks after every line, because it makes the code easier to read.

coveralls commented 10 years ago

Coverage Status

Coverage remained the same when pulling ca74bf25e1fe87d7c0aa6f5d9a10319a5357580c on benjamminf:master into f45fb4c3fde6a840c4290a27e02bc1f46c7fd226 on aakpat6:master.

avp commented 10 years ago

Looks like you accidentally committed some .idea files.

benjamminf commented 10 years ago

I need to stop using Git for Windows. It keeps sneaking in those .idea files even after ignoring them.

coveralls commented 10 years ago

Coverage Status

Coverage remained the same when pulling d23e4436648d67a6f51223f230708a088efa5789 on benjamminf:master into f45fb4c3fde6a840c4290a27e02bc1f46c7fd226 on aakpat6:master.

coveralls commented 10 years ago

Coverage Status

Coverage remained the same when pulling 4b28a06811333260940ee0f22f49706d7b387c8c on benjamminf:master into f45fb4c3fde6a840c4290a27e02bc1f46c7fd226 on aakpat6:master.

avp commented 10 years ago

This looks good - thanks!