Arduino library for converting RGB, HSV and HSL

Hi everyone,

I've ported some javascript code I found in order to create an Arduino library for converting between RGB, HSL and HSV:

https://github.com/ratkins/RGBConverter

I hope someone finds it useful.

Cheers, Robert.

Right, I have had this thread open since I first saw it but haven’t had a chance to look at it yet.

Sounds like it could be handy, thanks! :wink:

Good and useful idea for a library however current implementation contains serious bugs. Have you written test programs for converting forth and back resulting in the (approx) original values?

NB more values should be handled as float, e.g.:

void RGBConverter::rgbToHsl(byte r, byte g, byte b, double hsl[]) {
    r /= 255;
    g /= 255;
    b /= 255;

byte r = {0..255} and after r /= 255 it will become 0 (99.6% of the time) or 1.

Furthermore some sample applications to show how it can be used are allways good starting point. But still I like the idea!