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

Start non-unique ChatTheme.

This commit is contained in:
John Preston
2021-08-26 16:25:48 +03:00
parent f3dd8c68b3
commit 3cd0f9d189
40 changed files with 954 additions and 599 deletions

View File

@@ -868,9 +868,9 @@ void ChatBackground::adjustPaletteUsingColor(QColor color) {
std::optional<QColor> ChatBackground::colorForFill() const {
return !_prepared.isNull()
? imageMonoColor()
: !_gradient.isNull()
: (!_gradient.isNull() || _paper.backgroundColors().empty())
? std::nullopt
: _paper.backgroundColor();
: std::make_optional(_paper.backgroundColors().front());
}
QImage ChatBackground::gradientForFill() const {
@@ -1390,6 +1390,21 @@ bool IsNightMode() {
return GlobalBackground ? Background()->nightMode() : false;
}
rpl::producer<bool> IsNightModeValue() {
auto changes = Background()->updates(
) | rpl::filter([=](const BackgroundUpdate &update) {
return update.type == BackgroundUpdate::Type::ApplyingTheme;
}) | rpl::to_empty;
return rpl::single(
rpl::empty_value()
) | rpl::then(
std::move(changes)
) | rpl::map([=] {
return IsNightMode();
}) | rpl::distinct_until_changed();
}
void SetNightModeValue(bool nightMode) {
if (GlobalBackground || nightMode) {
Background()->setNightModeValue(nightMode);