Commit 655183ee authored by Konstantin Kharlamov's avatar Konstantin Kharlamov

ColorScheme: fix warning: "assignment from temporary initializer_list"

Fixes: dc29be39 "Keep perceived contrast in random background color"
Signed-off-by: Konstantin Kharlamov's avatarKonstantin Kharlamov <Hi-Angel@yandex.ru>
parent f79ee976
......@@ -310,12 +310,9 @@ ColorEntry ColorScheme::colorEntry(int index, uint randomSeed) const
const double maxLightness = qMin(baseLightness + range.lightness / 2.0, MaxLightness);
// Use triangular distribution with peak at L=50.0.
// Dark and very light colors are less distinguishable.
std::initializer_list<double> lightnessIntervals;
if (minLightness < 50.0 && 50.0 < maxLightness) {
lightnessIntervals = {minLightness, 50.0, maxLightness};
} else {
lightnessIntervals = {minLightness, maxLightness};
}
const auto lightnessIntervals = (minLightness < 50.0 && 50.0 < maxLightness)
? std::initializer_list<double>{minLightness, 50.0, maxLightness}
: std::initializer_list<double>{minLightness, maxLightness};
static const auto lightnessWeightsFunc = [](double v) { return 50.0 - qAbs(v - 50.0); };
std::piecewise_linear_distribution<> lightnessDistribution(lightnessIntervals,
lightnessWeightsFunc);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment