From d2435e0b2d76e9a2329b9bf822e5bb8b273c077d Mon Sep 17 00:00:00 2001 From: kseniazakharova Date: Fri, 29 Nov 2024 11:17:19 +0300 Subject: [PATCH] Add UpdateTextColorOnMainTheme function --- frameworks/core/components_ng/pattern/text/text_pattern.cpp | 6 ++++++ frameworks/core/components_ng/pattern/text/text_pattern.h | 1 + 2 files changed, 7 insertions(+) diff --git a/frameworks/core/components_ng/pattern/text/text_pattern.cpp b/frameworks/core/components_ng/pattern/text/text_pattern.cpp index 78b620d3c51c..290efcfe07f7 100644 --- a/frameworks/core/components_ng/pattern/text/text_pattern.cpp +++ b/frameworks/core/components_ng/pattern/text/text_pattern.cpp @@ -3464,6 +3464,11 @@ void TextPattern::OnForegroundColorUpdate(const Color& value) } void TextPattern::OnColorConfigurationUpdate() +{ + UpdateTextColorOnMainTheme(); +} + +void TextPattern::UpdateTextColorOnMainTheme() { auto host = GetHost(); CHECK_NULL_VOID(host); @@ -3626,6 +3631,7 @@ void TextPattern::CreateModifier() { if (!contentMod_) { contentMod_ = MakeRefPtr(textStyle_, WeakClaim(this)); + UpdateTextColorOnMainTheme(); } if (!overlayMod_) { overlayMod_ = MakeRefPtr(); diff --git a/frameworks/core/components_ng/pattern/text/text_pattern.h b/frameworks/core/components_ng/pattern/text/text_pattern.h index 2515f7e49790..27c9ef701cb4 100644 --- a/frameworks/core/components_ng/pattern/text/text_pattern.h +++ b/frameworks/core/components_ng/pattern/text/text_pattern.h @@ -743,6 +743,7 @@ public: } bool OnThemeScopeUpdate(int32_t themeScopeId) override; void OnColorConfigurationUpdate() override; + void UpdateTextColorOnMainTheme(); protected: int32_t GetClickedSpanPosition() -- Gitee