diff --git a/src/dpp/utility.cpp b/src/dpp/utility.cpp index 703815def1..a650b64d3d 100644 --- a/src/dpp/utility.cpp +++ b/src/dpp/utility.cpp @@ -311,17 +311,14 @@ namespace dpp { const auto hue_to_rgb = [](double p, double q, double t){ if (t < 0) { t += 1; - } - if (t > 1) { + } else if (t > 1) { t -= 1; } if (t < 1.0 / 6.0) { return p + (q - p) * 6.0 * t; - } - if (t < 0.5) { + } else if (t < 0.5) { return q; - } - if (t < 2.0 / 3.0) { + } else if (t < 2.0 / 3.0) { return p + (q - p) * (2.0 / 3.0 - t) * 6.0; } return p;