/*
4 * Authors: see git history
6 * Copyright (C) 2023 Authors
7 * Released under GNU GPL v2+, read the file
'COPYING' for more information.
26 return v1 + (v2 - v1) * h;
30 return v1 + (v2 - v1) * (4 - h);
54 double v1 = 2 * l - v2;
56 output[0] =
hue_2_rgb(v1, v2, h * 6 + 2.0);
58 output[2] =
hue_2_rgb(v1, v2, h * 6 - 2.0);
71 double max = std::max(std::max(r, g), b);
72 double min = std::min(std::min(r, g), b);
73 double delta = max - min;
77 double l = (max + min) / 2.0;
81 s =
delta / (max + min);
83 s =
delta / (2 - max - min);
88 h = 2.0 + (b - r) /
delta;
90 h = 4.0 + (r - g) /
delta;
110std::string
HSL::toString(std::vector<double>
const &values,
bool opacity)
const
114 return oo << (int)(values[0] * 360) << values[1] << values[2] << values.back();
std::string toString(std::vector< double > const &values, bool opacity=true) const override
Print the HSL color to a CSS string.
void spaceToProfile(std::vector< double > &output) const override
Convert the HSL color into sRGB components used in the sRGB icc profile.
void profileToSpace(std::vector< double > &output) const override
Convert from sRGB icc values to HSL values.
static float hue_2_rgb(float v1, float v2, float h)