|
7 | 7 | #include "TextDrawing.h" |
8 | 8 |
|
9 | 9 | #include <AutoDraw.h> |
10 | | -#include <Fabric/platform/react/renderer/graphics/PlatformColorUtils.h> |
11 | 10 | #include <Utils/ValueUtils.h> |
12 | 11 | #include <unicode.h> |
13 | 12 | #include <windows.ui.composition.interop.h> |
@@ -36,27 +35,11 @@ void RenderText( |
36 | 35 | // to cache and reuse a brush across all text elements instead, taking care to recreate |
37 | 36 | // it in the event of device removed. |
38 | 37 | winrt::com_ptr<ID2D1SolidColorBrush> brush; |
39 | | - |
40 | | - // Check if we should use theme-aware default color instead of hardcoded black |
41 | | - bool useDefaultColor = false; |
42 | 38 | if (textAttributes.foregroundColor) { |
43 | | - auto &color = *textAttributes.foregroundColor; |
44 | | - // If it's black (or very dark) without explicit PlatformColor, use theme-aware color |
45 | | - if (color.m_platformColor.empty() && color.m_color.R <= 10 && color.m_color.G <= 10 && color.m_color.B <= 10) { |
46 | | - useDefaultColor = true; |
47 | | - } |
48 | | - } else { |
49 | | - useDefaultColor = true; |
50 | | - } |
51 | | - |
52 | | - if (useDefaultColor) { |
53 | | - // Use theme-aware TextFillColorPrimary which adapts to light/dark mode |
54 | | - auto d2dColor = theme.D2DPlatformColor("TextFillColorPrimary"); |
55 | | - winrt::check_hresult(deviceContext.CreateSolidColorBrush(d2dColor, brush.put())); |
56 | | - } else { |
57 | | - // User set explicit color or PlatformColor - use it |
58 | 39 | auto color = theme.D2DColor(*textAttributes.foregroundColor); |
59 | 40 | winrt::check_hresult(deviceContext.CreateSolidColorBrush(color, brush.put())); |
| 41 | + } else { |
| 42 | + winrt::check_hresult(deviceContext.CreateSolidColorBrush(D2D1::ColorF(D2D1::ColorF::Black, 1.0f), brush.put())); |
60 | 43 | } |
61 | 44 |
|
62 | 45 | if (textAttributes.textDecorationLineType) { |
@@ -89,27 +72,12 @@ void RenderText( |
89 | 72 | (fragment.textAttributes.foregroundColor != textAttributes.foregroundColor) || |
90 | 73 | !isnan(fragment.textAttributes.opacity)) { |
91 | 74 | winrt::com_ptr<ID2D1SolidColorBrush> fragmentBrush; |
92 | | - |
93 | | - // Check if we should use theme-aware default color for this fragment |
94 | | - bool useFragmentDefaultColor = false; |
95 | 75 | if (fragment.textAttributes.foregroundColor) { |
96 | | - auto &color = *fragment.textAttributes.foregroundColor; |
97 | | - // If it's black (or very dark) without explicit PlatformColor, use theme-aware color |
98 | | - if (color.m_platformColor.empty() && color.m_color.R <= 10 && color.m_color.G <= 10 && color.m_color.B <= 10) { |
99 | | - useFragmentDefaultColor = true; |
100 | | - } |
101 | | - } else { |
102 | | - useFragmentDefaultColor = true; |
103 | | - } |
104 | | - |
105 | | - if (useFragmentDefaultColor) { |
106 | | - // Use theme-aware TextFillColorPrimary which adapts to light/dark mode |
107 | | - auto d2dColor = theme.D2DPlatformColor("TextFillColorPrimary"); |
108 | | - winrt::check_hresult(deviceContext.CreateSolidColorBrush(d2dColor, fragmentBrush.put())); |
109 | | - } else { |
110 | | - // User set explicit color or PlatformColor - use it |
111 | 76 | auto color = theme.D2DColor(*fragment.textAttributes.foregroundColor); |
112 | 77 | winrt::check_hresult(deviceContext.CreateSolidColorBrush(color, fragmentBrush.put())); |
| 78 | + } else { |
| 79 | + winrt::check_hresult( |
| 80 | + deviceContext.CreateSolidColorBrush(D2D1::ColorF(D2D1::ColorF::Black, 1.0f), fragmentBrush.put())); |
113 | 81 | } |
114 | 82 |
|
115 | 83 | if (fragment.textAttributes.textDecorationLineType) { |
|
0 commit comments