Added chat theme bubble gradient to all chats.

This commit is contained in:
23rd
2026-07-03 21:06:29 +03:00
committed by John Preston
parent 1bb2fc183b
commit eb0bfcec90
6 changed files with 36 additions and 11 deletions
+7 -5
View File
@@ -247,8 +247,9 @@ constexpr auto kMinAcceptableContrast = 1.14;// 4.5;
}
}
[[nodiscard]] QImage PrepareBubblesBackground(
const ChatThemeBubblesData &data) {
} // namespace
QImage PrepareBubblesBackground(const ChatThemeBubblesData &data) {
if (data.colors.size() < 2) {
return QImage();
}
@@ -256,8 +257,6 @@ constexpr auto kMinAcceptableContrast = 1.14;// 4.5;
return Images::GenerateLinearGradient(QSize(kSize, kSize), data.colors);
}
} // namespace
bool operator==(const ChatThemeBackground &a, const ChatThemeBackground &b) {
return (a.key == b.key)
&& (a.prepared.cacheKey() == b.prepared.cacheKey())
@@ -551,7 +550,10 @@ void ChatTheme::setBubblesBackground(QImage image) {
: _bubblesBackground.area),
});
if (!_bubblesBackgroundPattern) {
_bubblesBackgroundPattern = PrepareBubblePattern(palette());
const auto use = _palette
? _palette.get()
: style::main_palette::get().get();
_bubblesBackgroundPattern = PrepareBubblePattern(use);
}
_bubblesBackgroundPattern->pixmap = _bubblesBackground.pixmap;
// setBubblesBackground called only from background thread.