2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Use outbox bubble colors, adjust custom colors.

This commit is contained in:
John Preston
2021-09-06 13:18:14 +03:00
parent e4e5c4a1d2
commit c318f57fc0
18 changed files with 208 additions and 98 deletions

View File

@@ -752,12 +752,11 @@ void ChatBackground::setPrepared(
prepared = Ui::PrepareBlurredBackground(std::move(prepared));
}
if (adjustPaletteRequired()) {
if (!gradient.isNull()) {
adjustPaletteUsingBackground(gradient);
if ((prepared.isNull() || _paper.isPattern())
&& !_paper.backgroundColors().empty()) {
adjustPaletteUsingColors(_paper.backgroundColors());
} else if (!prepared.isNull()) {
adjustPaletteUsingBackground(prepared);
} else if (!_paper.backgroundColors().empty()) {
adjustPaletteUsingColor(_paper.backgroundColors().front());
}
}
@@ -819,6 +818,11 @@ void ChatBackground::adjustPaletteUsingBackground(const QImage &image) {
adjustPaletteUsingColor(Ui::CountAverageColor(image));
}
void ChatBackground::adjustPaletteUsingColors(
const std::vector<QColor> &colors) {
adjustPaletteUsingColor(Ui::CountAverageColor(colors));
}
void ChatBackground::adjustPaletteUsingColor(QColor color) {
const auto prepared = color.toHsl();
for (const auto &adjustable : _adjustableColors) {