From 2dfaf27884cfdd3627f3285f3a9deefe2324daa6 Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 8 Aug 2023 15:46:54 +0200 Subject: [PATCH] Fix colors for colorized stories reactions. --- .../SourceFiles/boxes/peers/edit_forum_topic_box.cpp | 1 + .../info/profile/info_profile_emoji_status_panel.cpp | 1 + .../media/stories/media_stories_reactions.cpp | 9 ++++++--- Telegram/SourceFiles/ui/effects/emoji_fly_animation.cpp | 4 +++- Telegram/SourceFiles/ui/effects/emoji_fly_animation.h | 2 ++ 5 files changed, 13 insertions(+), 4 deletions(-) diff --git a/Telegram/SourceFiles/boxes/peers/edit_forum_topic_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_forum_topic_box.cpp index 9727f6c61..d5dbc6789 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_forum_topic_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_forum_topic_box.cpp @@ -354,6 +354,7 @@ struct IconSelector { &owner->reactions(), std::move(args), [=] { state->animation->repaint(); }, + [] { return st::windowFg->c; }, Data::CustomEmojiSizeTag::Large); } state->iconId = id; diff --git a/Telegram/SourceFiles/info/profile/info_profile_emoji_status_panel.cpp b/Telegram/SourceFiles/info/profile/info_profile_emoji_status_panel.cpp index 352aa8b45..7a9e18b92 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_emoji_status_panel.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_emoji_status_panel.cpp @@ -229,6 +229,7 @@ void EmojiStatusPanel::startAnimation( &owner->reactions(), std::move(args), [=] { _animation->repaint(); }, + [] { return st::profileVerifiedCheckBg->c; }, _animationSizeTag); } diff --git a/Telegram/SourceFiles/media/stories/media_stories_reactions.cpp b/Telegram/SourceFiles/media/stories/media_stories_reactions.cpp index 01cdcebec..e9162d891 100644 --- a/Telegram/SourceFiles/media/stories/media_stories_reactions.cpp +++ b/Telegram/SourceFiles/media/stories/media_stories_reactions.cpp @@ -556,12 +556,12 @@ void Reactions::initLikeIcon( target.y() + (target.height() - inner) / 2, inner, inner); - p.drawImage(rect, icon->frame(st::windowFg->c)); + p.drawImage(rect, icon->frame(st::storiesComposeWhiteText->c)); } else { const auto customSize = fly->center.customSize; const auto scaled = (inner != customSize); fly->center.custom->paint(p, { - .textColor = st::windowFg->c, + .textColor = st::storiesComposeWhiteText->c, .size = { customSize, customSize }, .now = crl::now(), .scale = (scaled ? (inner / float64(customSize)) : 1.), @@ -650,11 +650,13 @@ void Reactions::setLikedId( bool force) { if (const auto done = setLikedIdIconInit(owner, id, force)) { const auto reactions = &owner->reactions(); + const auto colored = [] { return st::storiesComposeWhiteText->c; }; + const auto sizeTag = Data::CustomEmojiSizeTag::Isolated; done(Ui::EmojiFlyAnimation(_controller->wrap(), reactions, { .id = id, .scaleOutDuration = kReactionScaleOutDuration, .scaleOutTarget = kReactionScaleOutTarget, - }, [] {}, Data::CustomEmojiSizeTag::Isolated).grabBadgeCenter()); + }, [] {}, colored, sizeTag).grabBadgeCenter()); } } @@ -669,6 +671,7 @@ void Reactions::startReactionAnimation( &story->owner().reactions(), std::move(args), [=] { _reactionAnimation->repaint(); }, + [] { return st::storiesComposeWhiteText->c; }, Data::CustomEmojiSizeTag::Isolated); const auto layer = _reactionAnimation->layer(); wrap->paintRequest() | rpl::start_with_next([=] { diff --git a/Telegram/SourceFiles/ui/effects/emoji_fly_animation.cpp b/Telegram/SourceFiles/ui/effects/emoji_fly_animation.cpp index 16269c3ac..559e4ed35 100644 --- a/Telegram/SourceFiles/ui/effects/emoji_fly_animation.cpp +++ b/Telegram/SourceFiles/ui/effects/emoji_fly_animation.cpp @@ -33,8 +33,10 @@ EmojiFlyAnimation::EmojiFlyAnimation( not_null owner, ReactionFlyAnimationArgs &&args, Fn repaint, + Fn textColor, Data::CustomEmojiSizeTag tag) : _flySize(ComputeFlySize(tag)) +, _textColor(std::move(textColor)) , _fly( owner, std::move(args), @@ -63,7 +65,7 @@ EmojiFlyAnimation::EmojiFlyAnimation( QRect( rect.topLeft() + QPoint(skipx, skipy), QSize(_flySize, _flySize)), - st::infoPeerBadge.premiumFg->c, + _textColor(), clip, crl::now()); if (_areaUpdated || _area.isEmpty()) { diff --git a/Telegram/SourceFiles/ui/effects/emoji_fly_animation.h b/Telegram/SourceFiles/ui/effects/emoji_fly_animation.h index f868c7267..cf0e60099 100644 --- a/Telegram/SourceFiles/ui/effects/emoji_fly_animation.h +++ b/Telegram/SourceFiles/ui/effects/emoji_fly_animation.h @@ -21,6 +21,7 @@ public: not_null owner, Ui::ReactionFlyAnimationArgs &&args, Fn repaint, + Fn textColor, Data::CustomEmojiSizeTag tag); [[nodiscard]] not_null layer(); @@ -32,6 +33,7 @@ public: private: const int _flySize = 0; + Fn _textColor; Ui::ReactionFlyAnimation _fly; Ui::RpWidget _layer; QRect _area;