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(