Preserve alpha value in colorizer.
This commit is contained in:
parent
a8a4cc8c1a
commit
5a9878bea9
1 changed files with 4 additions and 3 deletions
|
|
@ -161,15 +161,16 @@ std::optional<QColor> colorize(const QColor &color, const colorizer &with) {
|
||||||
auto hue = 0;
|
auto hue = 0;
|
||||||
auto saturation = 0;
|
auto saturation = 0;
|
||||||
auto lightness = 0;
|
auto lightness = 0;
|
||||||
color.getHsv(&hue, &saturation, &lightness);
|
auto alpha = 0;
|
||||||
|
color.getHsv(&hue, &saturation, &lightness, &alpha);
|
||||||
const auto result = colorize(
|
const auto result = colorize(
|
||||||
colorizer::Color{ hue, saturation, lightness },
|
colorizer::Color{ hue, saturation, lightness },
|
||||||
with);
|
with);
|
||||||
if (!result) {
|
if (!result) {
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
const auto &fields = *result;
|
const auto &hsv = *result;
|
||||||
return QColor::fromHsv(fields.hue, fields.saturation, fields.value);
|
return QColor::fromHsv(hsv.hue, hsv.saturation, hsv.value, alpha);
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray colorize(
|
QByteArray colorize(
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue