Skip to content

Commit

Permalink
Fix PathShiftGradient colors with custom palettes.
Browse files Browse the repository at this point in the history
  • Loading branch information
john-preston committed Sep 13, 2021
1 parent 8589a8d commit ef633ec
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
9 changes: 7 additions & 2 deletions ui/effects/path_shift_gradient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion ui/effects/path_shift_gradient.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ class PathShiftGradient final {
PathShiftGradient(
const style::color &bg,
const style::color &fg,
Fn<void()> animationCallback);
Fn<void()> animationCallback,
rpl::producer<> paletteUpdated = nullptr);
~PathShiftGradient();

void startFrame(
Expand Down

0 comments on commit ef633ec

Please sign in to comment.