Preserve alpha value in colorizer.

This commit is contained in:
John Preston 2021-09-17 10:24:42 +03:00
parent a8a4cc8c1a
commit 5a9878bea9

View file

@ -161,15 +161,16 @@ std::optional<QColor> colorize(const QColor &color, const colorizer &with) {
auto hue = 0;
auto saturation = 0;
auto lightness = 0;
color.getHsv(&hue, &saturation, &lightness);
auto alpha = 0;
color.getHsv(&hue, &saturation, &lightness, &alpha);
const auto result = colorize(
colorizer::Color{ hue, saturation, lightness },
with);
if (!result) {
return std::nullopt;
}
const auto &fields = *result;
return QColor::fromHsv(fields.hue, fields.saturation, fields.value);
const auto &hsv = *result;
return QColor::fromHsv(hsv.hue, hsv.saturation, hsv.value, alpha);
}
QByteArray colorize(