diff --git a/frameworks/core/components_ng/pattern/text/text_pattern.cpp b/frameworks/core/components_ng/pattern/text/text_pattern.cpp index 78b620d3c51ca45e1d34031eb091ede41b1feb60..290efcfe07f7b3f52a43ddcba92531f4f12e7f9f 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 2515f7e49790bcdcf40549733d926fbe3b04e94f..27c9ef701cb4b3e36848eeb6d7f83691bcc2edde 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()