avp / spectra

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

Use hex string for toString() #11

Closed DavidTimms closed 10 years ago

DavidTimms commented 10 years ago

Just a quick addition to use hex string representation for a spectra object's toString() method. This allows for direct assignment to css properties, such as:

red = Spectra("#FF0000");
document.body.style.backgroundColor = red;

The rgba representation may be better, so you don't lose the alpha, but it is not supported in old browsers.

coveralls commented 10 years ago

Coverage Status

Coverage remained the same when pulling 3a4d2859921665221715969748c478cb437208f0 on DavidTimms:master into f45fb4c3fde6a840c4290a27e02bc1f46c7fd226 on aakpat6:master.

avp commented 10 years ago

You need to add some tests to make sure this works, and I'll merge it in. I know it's small, but it's nice to test everything to make sure that there wasn't a typo that we missed.

DavidTimms commented 10 years ago

OK, I've put a couple of tests in and changed the comment to block style to match the rest

coveralls commented 10 years ago

Coverage Status

Coverage remained the same when pulling 3e35b8ce4cb0a568461dc66ceba4394d32b1bcfc on DavidTimms:master into f45fb4c3fde6a840c4290a27e02bc1f46c7fd226 on aakpat6:master.