ColorConverterLib.h not working

Dear Team,

I want to convert rgb value to hsl and hsl to rgb. I have searched on net that a color converting library is present. So i try to use the "ColorConverterLib.h" but compiler gives error as given below:
C:\Users\NAVJOT\Documents\Arduino\libraries\ColorConverter\src\ColorConverterLib.cpp:10:29: fatal error: RGBConverterLib.h: No such file or directory.

Awaiting for your response.

Regards,
MB

It looks like your colour converter library is not in the right place.

How did you install it?
Have you tried the example code that came with it?
What code are you running?
What type of Arduino are you using?

I installed it from library manager ----> color converter by Luis Llamas.

yes i have tried the example code as well as below code on arduino mini pro

#include "ColorConverterLib.h"

//#include "RGBHSL.h"
//#include "RGBConverter.h"

void ColorConverter::RgbToHsv(uint8_t red, uint8_t green, uint8_t blue, double& hue, double& saturation, double& value)
{
auto rd = static_cast(red) / 255;
auto gd = static_cast(green) / 255;
auto bd = static_cast(blue) / 255;
auto max = threeway_max(rd, gd, bd), min = threeway_min(rd, gd, bd);

value = max;

auto d = max - min;
saturation = max == 0 ? 0 : d / max;

hue = 0;
if (max != min)
{
if (max == rd)
{
hue = (gd - bd) / d + (gd < bd ? 6 : 0);
}
else if (max == gd)
{
hue = (bd - rd) / d + 2;
}
else if (max == bd)
{
hue = (rd - gd) / d + 4;
}
hue /= 6;
}
}

void ColorConverter::RgbToHsl(uint8_t red, uint8_t green, uint8_t blue, double& hue, double& saturation, double& lighting)
{
auto rd = static_cast(red) / 255;
auto gd = static_cast(green) / 255;
auto bd = static_cast(blue) / 255;

auto max = threeway_max(rd, gd, bd);
auto min = threeway_min(rd, gd, bd);

double h, s, l = (max + min) / 2;

if (max == min)
{
h = s = 0; // achromatic
}
else
{
auto d = max - min;
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
if (max == rd)
{
h = (gd - bd) / d + (gd < bd ? 6 : 0);
}
else if (max == gd)
{
h = (bd - rd) / d + 2;
}
else if (max == bd)
{
h = (rd - gd) / d + 4;
}
h /= 6;
}

hue = h;
saturation = s;
lighting = l;
}

void ColorConverter::HsvToRgb(double hue, double saturation, double value, uint8_t& red, uint8_t& green, uint8_t& blue)
{
double r, g, b;

auto i = static_cast(hue * 6);
auto f = hue * 6 - i;
auto p = value * (1 - saturation);
auto q = value * (1 - f * saturation);
auto t = value * (1 - (1 - f) * saturation);

switch (i % 6)
{
case 0: r = value , g = t , b = p;
break;
case 1: r = q , g = value , b = p;
break;
case 2: r = p , g = value , b = t;
break;
case 3: r = p , g = q , b = value;
break;
case 4: r = t , g = p , b = value;
break;
case 5: r = value , g = p , b = q;
break;
}

red = static_cast<uint8_t>(r * 255);
green = static_cast<uint8_t>(g * 255);
blue = static_cast<uint8_t>(b * 255);
}

void ColorConverter::HslToRgb(double hue, double saturation, double lightness, uint8_t& red, uint8_t& green, uint8_t& blue)
{
double r, g, b;

if (saturation == 0)
{
r = g = b = lightness; // achromatic
}
else
{
auto q = lightness < 0.5 ? lightness * (1 + saturation) : lightness + saturation - lightness * saturation;
auto p = 2 * lightness - q;
r = hue2rgb(p, q, hue + 1 / 3.0);
g = hue2rgb(p, q, hue);
b = hue2rgb(p, q, hue - 1 / 3.0);
}

red = static_cast<uint8_t>(r * 255);
green = static_cast<uint8_t>(g * 255);
blue = static_cast<uint8_t>(b * 255);
}

void ColorConverter::TemperatureToRgb(int kelvin, uint8_t& red, uint8_t& green, uint8_t& blue)
{
auto temp = kelvin / 100;

if (temp <= 66)
{
red = 255;
green = 99.4708025861 * log(temp) - 161.1195681661;

if (temp <= 19)
{
  blue = 0;
}
else
{
  blue = 138.5177312231 * log(temp - 10) - 305.0447927307;
}

}
else
{
red = 329.698727446 * pow(temp - 60, -0.1332047592);
green = 288.1221695283 * pow(temp - 60, -0.0755148492);
blue = 255;
}
}

void ColorConverter::HexToRgb(String hex, uint8_t& red, uint8_t& green, uint8_t& blue)
{
long number;
if(hex[0] == '#') number = strtol(&hex[1], nullptr, 16);
else number = strtol(&hex[0], nullptr, 16);
red = number >> 16;
green = number >> 8 & 0xFF;
blue = number & 0xFF;
}

void ColorConverter::RgbToHex(uint8_t red, uint8_t green, uint8_t blue, String &hex)
{
char hexArray[6] = { 0 };
sprintf(hexArray, "%02X%02X%02X", red, green, blue);
hex = hexArray;
}

double inline ColorConverter::threeway_max(double a, double b, double c)
{
return max(a, max(b, c));
}

double inline ColorConverter::threeway_min(double a, double b, double c)
{
return min(a, min(b, c));
}

double ColorConverter::hue2rgb(double p, double q, double t)
{
if (t < 0) t += 1;
if (t > 1) t -= 1;
if (t < 1 / 6.0) return p + (q - p) * 6 * t;
if (t < 1 / 2.0) return q;
if (t < 2 / 3.0) return p + (q - p) * (2 / 3.0 - t) * 6;
return p;
}

This error is caused by a bug in the 1.1.0 release of that library. It has since been fixed, but due to the library author having neglected to make the required update to the library metadata, before releasing the fix, it was not made available to Library Manager.

You could manually remove and then replace the library with the latest version, but I note this statement in the readme:

Deprecated
This library is deprecated and it will be not longer maintained

Replaced by GitHub - luisllamasbinaburo/ESP-Color

It's not clear to me why a color conversion library would need to be specific to the Espressif microcontrollers, but that is the claim, so probably it won't be useful to you if you are using some microcontroller other than the ESP8266 or ESP32. I also notice that the library author has failed in the metadata department again, meaning ESP-Color is not a valid Arduino library. It could easily be made so by adding the metadata file required for the "recursive" library structure the author chose:
https://arduino.github.io/arduino-cli/latest/library-specification/#library-metadata

But it seems that if I spotted three absolutely fundamental errors after a minute of looking at these libraries, there are likely to be more to be found. So probably you would be better off looking for a higher quality alternative.