From ef633ec5039773a024eb3284a326f196a9e91ddf Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 13 Sep 2021 20:04:48 +0300 Subject: [PATCH] Fix PathShiftGradient colors with custom palettes. --- ui/effects/path_shift_gradient.cpp | 9 +++++++-- ui/effects/path_shift_gradient.h | 3 ++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/ui/effects/path_shift_gradient.cpp b/ui/effects/path_shift_gradient.cpp index 7e7c4cb..b8037b1 100644 --- a/ui/effects/path_shift_gradient.cpp +++ b/ui/effects/path_shift_gradient.cpp @@ -29,12 +29,17 @@ std::weak_ptr PathShiftGradient::Animation; PathShiftGradient::PathShiftGradient( const style::color &bg, const style::color &fg, - Fn animationCallback) + Fn animationCallback, + rpl::producer<> paletteUpdated) : _bg(bg) , _fg(fg) , _animationCallback(std::move(animationCallback)) { refreshColors(); - style::PaletteChanged( + if (!paletteUpdated) { + paletteUpdated = style::PaletteChanged(); + } + std::move( + paletteUpdated ) | rpl::start_with_next([=] { refreshColors(); }, _lifetime); diff --git a/ui/effects/path_shift_gradient.h b/ui/effects/path_shift_gradient.h index db44ba3..f92aa13 100644 --- a/ui/effects/path_shift_gradient.h +++ b/ui/effects/path_shift_gradient.h @@ -17,7 +17,8 @@ public: PathShiftGradient( const style::color &bg, const style::color &fg, - Fn animationCallback); + Fn animationCallback, + rpl::producer<> paletteUpdated = nullptr); ~PathShiftGradient(); void startFrame(