Fix PathShiftGradient colors with custom palettes.

This commit is contained in:
John Preston 2021-09-13 20:04:48 +03:00
parent 8589a8d850
commit ef633ec503
2 changed files with 9 additions and 3 deletions

View file

@ -29,12 +29,17 @@ std::weak_ptr<PathShiftGradient::AnimationData> PathShiftGradient::Animation;
PathShiftGradient::PathShiftGradient(
const style::color &bg,
const style::color &fg,
Fn<void()> animationCallback)
Fn<void()> 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);

View file

@ -17,7 +17,8 @@ public:
PathShiftGradient(
const style::color &bg,
const style::color &fg,
Fn<void()> animationCallback);
Fn<void()> animationCallback,
rpl::producer<> paletteUpdated = nullptr);
~PathShiftGradient();
void startFrame(