• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_CALENDAR_CALENDAR_THEME_H
17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_CALENDAR_CALENDAR_THEME_H
18 
19 #include "base/geometry/dimension.h"
20 #include "core/components/common/properties/color.h"
21 #include "core/components/theme/theme.h"
22 #include "core/components/theme/theme_constants.h"
23 #include "core/components/theme/theme_constants_defines.h"
24 
25 namespace OHOS::Ace {
26 namespace {
27 
28 constexpr Color DEFAULT_DAY_COLOR = Color(0xE1181819);
29 constexpr Color DEFAULT_NON_CURRENT_MONTH_DAY_COLOR = Color(0x4B181819);
30 constexpr Color DEFAULT_WEEKEND_DAY_COLOR = Color(0x7D181819);
31 constexpr Color DEFAULT_WEEKEND_LUNAR_COLOR = Color(0x7D181819);
32 constexpr Color DEFAULT_NON_CURRENT_MONTH_LUNAR_COLOR = Color(0x75181819);
33 constexpr Color DEFAULT_LUNAR_COLOR = Color(0x96181819);
34 constexpr Color DEFAULT_CALENDAR_WEEK_COLOR = Color(0xffa0a1a5);
35 constexpr Color DEFAULT_CALENDAR_DAY_COLOR = Color(0xffeaebed);
36 constexpr Color DEFAULT_CALENDAR_LUNAR_COLOR = Color(0xffa0a1a5);
37 constexpr Color DEFAULT_CALENDAR_WEEKEND_DAY_COLOR = Color(0xff808080);
38 constexpr Color DEFAULT_CALENDAR_WEEKEND_LUNAR_COLOR = Color(0xff808080);
39 constexpr Color DEFAULT_CALENDAR_TODAY_DAY_FOCUS_COLOR = Color(0xffffffff);
40 constexpr Color DEFAULT_CALENDAR_TODAY_LUNAR_FOCUS_COLOR = Color(0xffffffff);
41 constexpr Color DEFAULT_CALENDAR_TODAY_DAY_UNFOCUS_COLOR = Color(0xff0a59f7);
42 constexpr Color DEFAULT_CALENDAR_TODAY_LUNAR_UNFOCUS_COLOR = Color(0xff0a59f7);
43 constexpr Color DEFAULT_CALENDAR_WORK_MARK_COLOR = Color(0xffe84026);
44 constexpr Color DEFAULT_CALENDAR_OFF_MARK_COLOR = Color(0xff0a59f7);
45 constexpr Color DEFAULT_CALENDAR_NONCURRENT_MONTH_WORK_MARK_COLOR = Color(0x33e84026);
46 constexpr Color DEFAULT_CALENDAR_NONCURRENT_MONTH_OFF_MARK_COLOR = Color(0x330a59f7);
47 constexpr Color DEFAULT_CALENDAR_NONCURRENT_MONTH_DAY_COLOR = Color(0xff555e6b);
48 constexpr Color DEFAULT_CALENDAR_NONCURRENT_MONTH_LUNAR_COLOR = Color(0xff555e6b);
49 constexpr Color DEFAULT_CALENDAR_FOCUS_AREA_BACKGROUND_COLOR = Color(0xff5ea1ff);
50 constexpr Color DEFAULT_CALENDAR_BLUR_AREA_BACKGROUND_COLOR = Color(0xffffffff);
51 } // namespace
52 
53 struct CalendarThemeStructure {
54     std::string dayFontWeight = "500";
55     std::string lunarDayFontWeight = "500";
56     std::string workStateFontWeight = "500";
57     Color weekColor;
58     Color dayColor;
59     Color lunarColor;
60     Color weekendDayColor;
61     Color weekendLunarColor;
62     Color todayColor;
63     Color todayLunarColor;
64     Color nonCurrentMonthDayColor;
65     Color nonCurrentMonthLunarColor;
66     Color workDayMarkColor;
67     Color offDayMarkColor;
68     Color nonCurrentMonthWorkDayMarkColor;
69     Color nonCurrentMonthOffDayMarkColor;
70     Color focusedDayColor;
71     Color focusedLunarColor;
72     Color focusedAreaBackgroundColor;
73     Color blurAreaBackgroundColor;
74     Color titleTextColor;
75     Color touchColor;
76     Color markLunarColor;
77     Color clickEffectColor;
78     Color simpleWorkTextColor;
79     Color simpleOffTextColor;
80     Dimension weekFontSize;
81     Dimension dayFontSize;
82     Dimension lunarDayFontSize;
83     Dimension workDayMarkSize;
84     Dimension offDayMarkSize;
85     Dimension focusedAreaRadius;
86     Dimension topPadding;
87     Dimension workStateWidth;
88     Dimension workStateHorizontalMovingDistance;
89     Dimension workStateVerticalMovingDistance;
90     Dimension colSpace;
91     Dimension weekHeight;
92     Dimension dayHeight;
93     Dimension weekWidth;
94     Dimension dayWidth;
95     Dimension weekAndDayRowSpace;
96     Dimension dailyFiveRowSpace;
97     Dimension dailySixRowSpace;
98     Dimension gregorianCalendarHeight;
99     Dimension lunarHeight;
100     Dimension arrowHeight;
101     Dimension arrowWidth;
102     Dimension buttonWidth;
103     Dimension buttonHeight;
104     Dimension titleFontSize;
105     Dimension workStateOffset;
106     Dimension dayYAxisOffset;
107     Dimension lunarDayYAxisOffset;
108     Dimension underscoreXAxisOffset;
109     Dimension underscoreYAxisOffset;
110     Dimension scheduleMarkerXAxisOffset;
111     Dimension scheduleMarkerYAxisOffset;
112     Dimension underscoreWidth;
113     Dimension underscoreLength;
114     Dimension scheduleMarkerRadius;
115     Dimension touchCircleStrokeWidth;
116     Dimension boundaryRowOffset;
117     Dimension boundaryColOffset;
118 };
119 
120 class CalendarTheme : public virtual Theme {
121     DECLARE_ACE_TYPE(CalendarTheme, Theme);
122 
123 public:
124     ~CalendarTheme() override = default;
125     class Builder {
126     public:
127         Builder() = default;
128         ~Builder() = default;
129 
Build(const RefPtr<ThemeConstants> & themeConstants)130         RefPtr<CalendarTheme> Build(const RefPtr<ThemeConstants>& themeConstants) const
131         {
132             RefPtr<CalendarTheme> theme = AceType::Claim(new CalendarTheme());
133             if (!themeConstants) {
134                 return theme;
135             }
136             theme = AceType::Claim(new CalendarTheme());
137             ParseNewPattern(themeConstants, theme);
138             ParsePattern(themeConstants, theme);
139             return theme;
140         }
141     private:
ParsePattern(const RefPtr<ThemeConstants> & themeConstants,const RefPtr<CalendarTheme> & theme)142         void ParsePattern(const RefPtr<ThemeConstants>& themeConstants, const RefPtr<CalendarTheme>& theme) const
143         {
144             RefPtr<ThemeStyle> pattern = themeConstants->GetPatternByName(THEME_PATTERN_CALENDAR);
145             if (!pattern) {
146                 LOGW("find pattern of calendar fail");
147                 return;
148             }
149             // Card theme
150             theme->cardCalendarTheme_.focusedAreaBackgroundColor =
151                 pattern->GetAttr<Color>("card_area_bg_color_focused", Color::BLUE);
152             theme->cardCalendarTheme_.dayColor =
153                 pattern->GetAttr<Color>("card_day_color", DEFAULT_DAY_COLOR);
154             theme->cardCalendarTheme_.weekColor =
155                 pattern->GetAttr<Color>("card_week_color", Color::BLACK);
156             theme->cardCalendarTheme_.nonCurrentMonthDayColor =
157                 pattern->GetAttr<Color>("card_uncurrent_month_day_color", DEFAULT_NON_CURRENT_MONTH_DAY_COLOR);
158             theme->cardCalendarTheme_.weekendDayColor =
159                 pattern->GetAttr<Color>("card_weekend_color", DEFAULT_WEEKEND_DAY_COLOR);
160             theme->cardCalendarTheme_.weekendLunarColor =
161                 pattern->GetAttr<Color>("card_weekend_lunar_color", DEFAULT_WEEKEND_LUNAR_COLOR);
162             theme->cardCalendarTheme_.nonCurrentMonthLunarColor =
163                 pattern->GetAttr<Color>("card_uncurrent_month_lunar_color", DEFAULT_NON_CURRENT_MONTH_LUNAR_COLOR);
164             theme->cardCalendarTheme_.todayColor =
165                 pattern->GetAttr<Color>("card_today_color", Color::WHITE);
166             theme->cardCalendarTheme_.todayLunarColor =
167                 pattern->GetAttr<Color>("card_today_lunar_color", Color::WHITE);
168             theme->cardCalendarTheme_.lunarColor =
169                 pattern->GetAttr<Color>("card_lunar_color", DEFAULT_LUNAR_COLOR);
170             theme->cardCalendarTheme_.markLunarColor =
171                 pattern->GetAttr<Color>("card_mark_lunar_color", Color::BLUE);
172             theme->cardCalendarTheme_.titleTextColor =
173                 pattern->GetAttr<Color>("card_title_text_color", Color::BLACK);
174             theme->cardCalendarTheme_.clickEffectColor =
175                 pattern->GetAttr<Color>("card_switch_button_bg_color_clicked", Color::TRANSPARENT);
176 
177             // Normal theme
178             theme->calendarTheme_.dayColor =
179                 pattern->GetAttr<Color>(CALENDAR_DAY_COLOR, DEFAULT_CALENDAR_DAY_COLOR);
180             theme->calendarTheme_.weekColor =
181                 pattern->GetAttr<Color>(CALENDAR_WEEK_COLOR, DEFAULT_CALENDAR_WEEK_COLOR);
182             theme->calendarTheme_.lunarColor =
183                 pattern->GetAttr<Color>(CALENDAR_LUNAR_COLOR, DEFAULT_CALENDAR_LUNAR_COLOR);
184             theme->calendarTheme_.weekendDayColor =
185                 pattern->GetAttr<Color>(CALENDAR_WEEKEND_DAY_COLOR, DEFAULT_CALENDAR_WEEKEND_DAY_COLOR);
186             theme->calendarTheme_.weekendLunarColor =
187                 pattern->GetAttr<Color>(CALENDAR_WEEKEND_LUNAR_COLOR, DEFAULT_CALENDAR_WEEKEND_LUNAR_COLOR);
188             theme->calendarTheme_.focusedDayColor =
189                 pattern->GetAttr<Color>(CALENDAR_TODAY_DAY_FOCUS_COLOR, DEFAULT_CALENDAR_TODAY_DAY_FOCUS_COLOR);
190             theme->calendarTheme_.focusedLunarColor =
191                 pattern->GetAttr<Color>(CALENDAR_TODAY_LUNAR_FOCUS_COLOR, DEFAULT_CALENDAR_TODAY_LUNAR_FOCUS_COLOR);
192             theme->calendarTheme_.todayColor =
193                 pattern->GetAttr<Color>(CALENDAR_TODAY_DAY_UNFOCUS_COLOR, DEFAULT_CALENDAR_TODAY_DAY_UNFOCUS_COLOR);
194             theme->calendarTheme_.todayLunarColor =
195                 pattern->GetAttr<Color>(CALENDAR_TODAY_LUNAR_UNFOCUS_COLOR, DEFAULT_CALENDAR_TODAY_LUNAR_UNFOCUS_COLOR);
196             theme->calendarTheme_.workDayMarkColor =
197                 pattern->GetAttr<Color>(CALENDAR_WORK_MARK_COLOR, DEFAULT_CALENDAR_WORK_MARK_COLOR);
198             theme->calendarTheme_.offDayMarkColor =
199                 pattern->GetAttr<Color>(CALENDAR_OFF_MARK_COLOR, DEFAULT_CALENDAR_OFF_MARK_COLOR);
200             theme->calendarTheme_.nonCurrentMonthWorkDayMarkColor = pattern->GetAttr<Color>(
201                 CALENDAR_NONCURRENT_MONTH_WORK_MARK_COLOR, DEFAULT_CALENDAR_NONCURRENT_MONTH_WORK_MARK_COLOR);
202             theme->calendarTheme_.nonCurrentMonthOffDayMarkColor = pattern->GetAttr<Color>(
203                 CALENDAR_NONCURRENT_MONTH_OFF_MARK_COLOR, DEFAULT_CALENDAR_NONCURRENT_MONTH_OFF_MARK_COLOR);
204             theme->calendarTheme_.nonCurrentMonthDayColor = pattern->GetAttr<Color>(
205                 CALENDAR_NONCURRENT_MONTH_DAY_COLOR, DEFAULT_CALENDAR_NONCURRENT_MONTH_DAY_COLOR);
206             theme->calendarTheme_.nonCurrentMonthLunarColor = pattern->GetAttr<Color>(
207                 CALENDAR_NONCURRENT_MONTH_LUNAR_COLOR, DEFAULT_CALENDAR_NONCURRENT_MONTH_LUNAR_COLOR);
208             theme->calendarTheme_.focusedAreaBackgroundColor = pattern->GetAttr<Color>(
209                 CALENDAR_FOCUS_AREA_BACKGROUND_COLOR, DEFAULT_CALENDAR_FOCUS_AREA_BACKGROUND_COLOR);
210             theme->calendarTheme_.blurAreaBackgroundColor = pattern->GetAttr<Color>(
211                 CALENDAR_BLUR_AREA_BACKGROUND_COLOR, DEFAULT_CALENDAR_BLUR_AREA_BACKGROUND_COLOR);
212             // calendar picker
213             theme->entryBorderColor_ = pattern->GetAttr<Color>("calendar_picker_entry_border_color", Color());
214             theme->entryArrowColor_ = pattern->GetAttr<Color>("calendar_picker_entry_arrow_color", Color());
215             theme->selectBackgroundColor_ = pattern->GetAttr<Color>(
216                 "calendar_picker_select_background_color", Color());
217             theme->dialogBackgroundColor_ = pattern->GetAttr<Color>(
218                 "calendar_picker_dialog_background_color", Color());
219             theme->calendarTitleFontColor_ = pattern->GetAttr<Color>("calendar_picker_title_font_color", Color());
220             Color currentMonthColor = pattern->GetAttr<Color>("calendar_picker_title_font_color", Color());
221             theme->textCurrentMonthColor_ = currentMonthColor.BlendOpacity(
222                 pattern->GetAttr<double>("calendar_picker_attribute_alpha_content_primary", 0.0));
223             theme->textNonCurrentMonthColor_ = currentMonthColor.BlendOpacity(
224                 pattern->GetAttr<double>("calendar_picker_attribute_alpha_content_tertiary", 0.0));
225             theme->textSelectedDayColor_ = pattern->GetAttr<Color>(
226                 "calendar_picker_text_selected_day_color", Color());
227             theme->textCurrentDayColor_ = pattern->GetAttr<Color>("calendar_picker_text_current_day_color", Color());
228             theme->backgroundKeyFocusedColor_ = pattern->GetAttr<Color>(
229                 "calendar_picker_background_key_focused_color", Color());
230             Color backgroundSelectedTodayColor = pattern->GetAttr<Color>(
231                 "calendar_picker_background_selected_focused_color", Color());
232             theme->dialogButtonBackgroundColor_ = pattern->GetAttr<Color>(
233                 "calendar_picker_dialog_button_bg_color", Color());
234             theme->backgroundSelectedTodayColor_ = backgroundSelectedTodayColor;
235             theme->backgroundSelectedNotTodayColor_ = backgroundSelectedTodayColor.BlendOpacity(
236                 pattern->GetAttr<double>("calendar_picker_attribute_alpha_highlight_bg", 0.0));
237             theme->backgroundHoverColor_ = pattern->GetAttr<Color>("calendar_picker_background_hover_color", Color());
238             theme->backgroundPressColor_ = pattern->GetAttr<Color>("calendar_picker_background_press_color", Color());
239             theme->entryFontColor_ = pattern->GetAttr<Color>("calendar_picker_entry_font_color", Color());
240             theme->dialogDividerColor_ = pattern->GetAttr<Color>("calendar_picker_dialog_divider_color", Color());
241             theme->entryHeight_ = pattern->GetAttr<Dimension>("calendar_picker_entry_height", 0.0_vp);
242             theme->entryBorderWidth_ = pattern->GetAttr<Dimension>("calendar_picker_entry_border_width", 0.0_vp);
243             theme->entryBorderRadius_ = pattern->GetAttr<Dimension>("calendar_picker_entry_border_radius", 0.0_vp);
244             theme->entryButtonWidth_ = pattern->GetAttr<Dimension>("calendar_picker_entry_button_width", 0.0_vp);
245             theme->entryArrowHeight_ = pattern->GetAttr<Dimension>("calendar_picker_entry_arrow_height", 0.0_vp);
246             theme->entryArrowwidth_ = pattern->GetAttr<Dimension>("calendar_picker_entry_arrow_width", 0.0_vp);
247             theme->entryDateLeftRightMargin_ = pattern->GetAttr<Dimension>(
248                 "calendar_picker_entry_date_left_right_margin", 0.0_vp);
249             theme->entryDateTopBottomMargin_ = pattern->GetAttr<Dimension>(
250                 "calendar_picker_entry_date_top_bottom_margin", 0.0_vp);
251             theme->dialogMargin_ = pattern->GetAttr<Dimension>("calendar_picker_dialog_margin", 0.0_vp);
252             theme->calendarPickerDayWidthOrHeight_ = pattern->GetAttr<Dimension>(
253                 "calendar_picker_day_width_height", 0.0_vp);
254             theme->calendarDayFontSize_ = pattern->GetAttr<Dimension>("calendar_picker_day_font_size", 0.0_vp);
255             theme->distanceBetweenContainterAndDate_ = pattern->GetAttr<Dimension>(
256                 "calendar_picker_distance_between_container_and_date", 0.0_vp);
257             theme->distanceBetweenTitleAndDate_ = pattern->GetAttr<Dimension>(
258                 "calendar_picker_distance_between_title_and_date", 0.0_vp);
259             theme->dalendarContainerHeight_ = pattern->GetAttr<Dimension>("calendar_picker_container_height", 0.0_vp);
260             theme->calendarTitleFontSize_ = pattern->GetAttr<Dimension>("calendar_picker_title_font_size", 0.0_vp);
261             theme->calendarTitleRowHeight_ = pattern->GetAttr<Dimension>("calendar_picker_title_row_height", 0.0_vp);
262             theme->calendarTitleRowTopPadding_ = pattern->GetAttr<Dimension>(
263                 "calendar_picker_title_row_top_padding", 0.0_vp);
264             theme->calendarTitleRowLeftRightPadding_ = pattern->GetAttr<Dimension>(
265                 "calendar_picker_title_row_left_right_padding", 0.0_vp);
266             theme->calendarTitleTextPadding_ = pattern->GetAttr<Dimension>(
267                 "calendar_picker_title_text_padding", 0.0_vp);
268             theme->calendarTitleImagePadding_ = pattern->GetAttr<Dimension>(
269                 "calendar_picker_title_image_padding", 0.0_vp);
270             theme->calendarImageWidthHeight_ = pattern->GetAttr<Dimension>(
271                 "calendar_picker_image_width_height", 0.0_vp);
272             theme->calendarActionRowTopPadding_ = pattern->GetAttr<Dimension>(
273                 "calendar_picker_action_row_top_padding", 0.0_vp);
274             theme->calendarActionRowBottomLeftRightPadding_ = pattern->GetAttr<Dimension>(
275                 "calendar_picker_action_row_bottom_left_right_padding", 0.0_vp);
276             theme->calendarActionRowHeight_ = pattern->GetAttr<Dimension>("calendar_picker_action_row_height", 0.0_vp);
277             theme->calendarDayRadius_ = pattern->GetAttr<Dimension>("calendar_picker_day_radius", 0.0_vp);
278             theme->calendarDayKeyFocusedWidth_ = pattern->GetAttr<Dimension>("calendar_day_key_focused_width", 0.0_vp);
279             theme->calendarDayKeyFocusedPenWidth_ = pattern->GetAttr<Dimension>(
280                 "calendar_day_key_focused_pen_width", 0.0_vp);
281             theme->entryFontSize_ = pattern->GetAttr<Dimension>("calendar_picker_entry_font_size", 0.0_fp);
282             theme->dialogBorderRadius_ = pattern->GetAttr<Dimension>("calendar_picker_dialog_border_radius", 0.0_vp);
283         }
284 
ParseNewPattern(const RefPtr<ThemeConstants> & themeConstants,const RefPtr<CalendarTheme> & theme)285         void ParseNewPattern(const RefPtr<ThemeConstants>& themeConstants, const RefPtr<CalendarTheme>& theme) const
286         {
287             RefPtr<ThemeStyle> pattern = themeConstants->GetPatternByName(THEME_PATTERN_CALENDAR);
288             if (!pattern) {
289                 LOGW("find pattern of calendar fail");
290                 return;
291             }
292             theme->calendarTheme_.weekFontSize = pattern->GetAttr<Dimension>("calendar_week_font_size", 14.0_fp);
293             theme->calendarTheme_.dayFontSize = pattern->GetAttr<Dimension>("calendar_day_font_size", 18.0_fp);
294             theme->calendarTheme_.lunarDayFontSize = pattern->GetAttr<Dimension>("calendar_lunar_font_size", 12.0_fp);
295             theme->calendarTheme_.workDayMarkSize =
296                 pattern->GetAttr<Dimension>("calendar_work_day_mark_font_size", 10.0_fp);
297             theme->calendarTheme_.offDayMarkSize =
298                 pattern->GetAttr<Dimension>("calendar_off_day_mark_font_size", 10.0_fp);
299             theme->calendarTheme_.focusedAreaRadius =
300                 pattern->GetAttr<Dimension>("calendar_focused_area_radius", 24.0_vp);
301             theme->calendarTheme_.topPadding = pattern->GetAttr<Dimension>("top_padding", 16.0_vp);
302             theme->calendarTheme_.workStateWidth = pattern->GetAttr<Dimension>("work_state_width", 16.0_vp);
303             theme->calendarTheme_.workStateHorizontalMovingDistance =
304                 pattern->GetAttr<Dimension>("work_state_horizontal_moving_distance", 2.0_vp);
305             theme->calendarTheme_.workStateVerticalMovingDistance =
306                 pattern->GetAttr<Dimension>("work_state_vertical_moving_distance", 16.0_vp);
307             theme->calendarTheme_.colSpace = pattern->GetAttr<Dimension>("column_space", 39.0_vp);
308             theme->calendarTheme_.weekHeight = pattern->GetAttr<Dimension>("week_height", 19.0_vp);
309             theme->calendarTheme_.dayHeight = pattern->GetAttr<Dimension>("day_height", 41.0_vp);
310             theme->calendarTheme_.weekWidth = pattern->GetAttr<Dimension>("week_width", 48.0_vp);
311             theme->calendarTheme_.dayWidth = pattern->GetAttr<Dimension>("day_width", 48.0_vp);
312             theme->calendarTheme_.weekAndDayRowSpace = pattern->GetAttr<Dimension>("week_and_day_space", 12.0_vp);
313             theme->calendarTheme_.dailyFiveRowSpace = pattern->GetAttr<Dimension>("five_row_space", 20.0_vp);
314             theme->calendarTheme_.dailySixRowSpace = pattern->GetAttr<Dimension>("six_row_space", 10.0_vp);
315             theme->calendarTheme_.gregorianCalendarHeight = pattern->GetAttr<Dimension>("gregorian_height", 25.0_vp);
316             theme->calendarTheme_.dayFontWeight = pattern->GetAttr<std::string>("day_font_weight", "500");
317             theme->calendarTheme_.lunarDayFontWeight = pattern->GetAttr<std::string>("lunar_day_font_weight", "500");
318             theme->calendarTheme_.workStateFontWeight = pattern->GetAttr<std::string>("work_state_font_weight", "400");
319             theme->calendarTheme_.workStateOffset =
320                 pattern->GetAttr<Dimension>("work_state_center_adjustment", 0.0_vp);
321             theme->calendarTheme_.dayYAxisOffset = pattern->GetAttr<Dimension>("day_yaxis_offset", 4.0_vp);
322             theme->calendarTheme_.lunarDayYAxisOffset = pattern->GetAttr<Dimension>("lunar_day_yaxis_offset", 23.0_vp);
323             theme->calendarTheme_.underscoreXAxisOffset =
324                 pattern->GetAttr<Dimension>("underscore_xaxis_offset", 12.0_vp);
325             theme->calendarTheme_.underscoreYAxisOffset =
326                 pattern->GetAttr<Dimension>("underscore_yaxis_offset", 36.0_vp);
327             theme->calendarTheme_.scheduleMarkerXAxisOffset =
328                 pattern->GetAttr<Dimension>("schedule_marker_xaxis_offset", 22.0_vp);
329             theme->calendarTheme_.scheduleMarkerYAxisOffset =
330                 pattern->GetAttr<Dimension>("schedule_marker_yaxis_offset", 40.0_vp);
331             theme->calendarTheme_.touchCircleStrokeWidth =
332                 pattern->GetAttr<Dimension>("touch_circle_stroke_width", 1.0_vp);
333             theme->calendarTheme_.lunarHeight = pattern->GetAttr<Dimension>("lunar_height", 14.0_vp);
334             theme->calendarTheme_.underscoreWidth = pattern->GetAttr<Dimension>("underscore_width", 1.0_vp);
335             theme->calendarTheme_.underscoreLength = pattern->GetAttr<Dimension>("underscore_length", 20.0_vp);
336             theme->calendarTheme_.scheduleMarkerRadius =
337                 pattern->GetAttr<Dimension>("schedule_marker_radius", 2.0_vp);
338             theme->cardCalendarTheme_.arrowHeight = pattern->GetAttr<Dimension>("arrow_height", 16.0_vp);
339             theme->cardCalendarTheme_.arrowWidth = pattern->GetAttr<Dimension>("arrow_width", 16.0_vp);
340             theme->cardCalendarTheme_.buttonHeight =
341                 pattern->GetAttr<Dimension>("card_calendar_button_height", 32.0_vp);
342             theme->cardCalendarTheme_.buttonWidth =
343                 pattern->GetAttr<Dimension>("card_calendar_button_width", 32.0_vp);
344             theme->cardCalendarTheme_.titleFontSize =
345                 pattern->GetAttr<Dimension>("card_calendar_title_font_size", 16.0_vp);
346             theme->cardCalendarTheme_.focusedDayColor =
347                 pattern->GetAttr<Color>("today_day_focus_color", Color(0xFFFFFFFF));
348             theme->cardCalendarTheme_.touchColor = pattern->GetAttr<Color>("calendar_touch_color", Color(0x320A59F7));
349             theme->cardCalendarTheme_.topPadding = pattern->GetAttr<Dimension>("card_calendar_top_padding", 0.0_vp);
350             theme->cardCalendarTheme_.weekHeight = pattern->GetAttr<Dimension>("card_calendar_week_height", 14.0_vp);
351             theme->cardCalendarTheme_.dayHeight = pattern->GetAttr<Dimension>("card_calendar_day_height", 44.0_vp);
352             theme->cardCalendarTheme_.weekWidth = pattern->GetAttr<Dimension>("card_calendar_week_width", 44.0_vp);
353             theme->cardCalendarTheme_.dayWidth = pattern->GetAttr<Dimension>("card_calendar_day_width", 44.0_vp);
354             theme->cardCalendarTheme_.focusedAreaRadius =
355                 pattern->GetAttr<Dimension>("card_calendar_focus_area_radius", 22.0_vp);
356             theme->cardCalendarTheme_.weekFontSize =
357                 pattern->GetAttr<Dimension>("card_calendar_week_font_size", 10.0_fp);
358             theme->cardCalendarTheme_.dayFontSize =
359                 pattern->GetAttr<Dimension>("card_calendar_day_font_size", 16.0_vp);
360             theme->cardCalendarTheme_.gregorianCalendarHeight =
361                 pattern->GetAttr<Dimension>("card_calendar_gregorian_height", 24.0_vp);
362             theme->cardCalendarTheme_.lunarDayFontSize =
363                 pattern->GetAttr<Dimension>("card_calendar_lunar_font_size", 10.0_vp);
364             theme->cardCalendarTheme_.workDayMarkColor = pattern->GetAttr<Color>("work_mark_color", Color(0xffe83f26));
365             theme->cardCalendarTheme_.weekAndDayRowSpace =
366                 pattern->GetAttr<Dimension>("card_calendar_week_day_row_space", 4.0_vp);
367             theme->cardCalendarTheme_.dailyFiveRowSpace =
368                 pattern->GetAttr<Dimension>("card_calendar_daily_five_row_space", 10.0_vp);
369             theme->cardCalendarTheme_.dayYAxisOffset = pattern->GetAttr<Dimension>("day_yaxis_offset", 4.0_vp);
370             theme->cardCalendarTheme_.lunarDayYAxisOffset =
371                 pattern->GetAttr<Dimension>("lunar_day_yaxis_offset", 23.0_vp);
372             theme->cardCalendarTheme_.underscoreXAxisOffset =
373                 pattern->GetAttr<Dimension>("underscore_xaxis_offset", 12.0_vp);
374             theme->cardCalendarTheme_.underscoreYAxisOffset =
375                 pattern->GetAttr<Dimension>("underscore_yaxis_offset", 36.0_vp);
376             theme->cardCalendarTheme_.scheduleMarkerXAxisOffset =
377                 pattern->GetAttr<Dimension>("schedule_marker_xaxis_offset", 22.0_vp);
378             theme->cardCalendarTheme_.scheduleMarkerYAxisOffset =
379                 pattern->GetAttr<Dimension>("schedule_marker_yaxis_offset", 40.0_vp);
380             theme->cardCalendarTheme_.lunarHeight = pattern->GetAttr<Dimension>("lunar_height", 14.0_vp);
381             theme->cardCalendarTheme_.underscoreWidth = pattern->GetAttr<Dimension>("underscore_width", 1.0_vp);
382             theme->cardCalendarTheme_.underscoreLength = pattern->GetAttr<Dimension>("underscore_length", 20.0_vp);
383             theme->cardCalendarTheme_.scheduleMarkerRadius =
384                 pattern->GetAttr<Dimension>("schedule_marker_radius", 2.0_vp);
385             theme->cardCalendarTheme_.boundaryColOffset =
386                 pattern->GetAttr<Dimension>("boundary_col_offset", 50.0_vp);
387         }
388     };
389 
GetCalendarTheme()390     CalendarThemeStructure& GetCalendarTheme()
391     {
392         return calendarTheme_;
393     }
394 
GetCardCalendarTheme()395     CalendarThemeStructure& GetCardCalendarTheme()
396     {
397         return cardCalendarTheme_;
398     }
399 
GetEntryHeight()400     const Dimension& GetEntryHeight() const
401     {
402         return entryHeight_;
403     }
404 
GetEntryBorderWidth()405     const Dimension& GetEntryBorderWidth() const
406     {
407         return entryBorderWidth_;
408     }
409 
GetEntryBorderColor()410     const Color& GetEntryBorderColor() const
411     {
412         return entryBorderColor_;
413     }
414 
GetEntryBorderRadius()415     const Dimension& GetEntryBorderRadius() const
416     {
417         return entryBorderRadius_;
418     }
419 
GetEntryButtonWidth()420     const Dimension& GetEntryButtonWidth() const
421     {
422         return entryButtonWidth_;
423     }
424 
GetEntryDateTopBottomMargin()425     const Dimension& GetEntryDateTopBottomMargin() const
426     {
427         return entryDateTopBottomMargin_;
428     }
429 
GetEntryDateLeftRightMargin()430     const Dimension& GetEntryDateLeftRightMargin() const
431     {
432         return entryDateLeftRightMargin_;
433     }
434 
GetEntryArrowWidth()435     const Dimension& GetEntryArrowWidth() const
436     {
437         return entryArrowwidth_;
438     }
439 
GetEntryArrowHeight()440     const Dimension& GetEntryArrowHeight() const
441     {
442         return entryArrowHeight_;
443     }
444 
GetEntryArrowColor()445     const Color& GetEntryArrowColor() const
446     {
447         return entryArrowColor_;
448     }
449 
GetDialogMargin()450     const Dimension& GetDialogMargin() const
451     {
452         return dialogMargin_;
453     }
454 
GetSelectBackgroundColor()455     const Color& GetSelectBackgroundColor() const
456     {
457         return selectBackgroundColor_;
458     }
459 
GetCalendarPickerDayWidthOrHeight()460     const Dimension& GetCalendarPickerDayWidthOrHeight() const
461     {
462         return calendarPickerDayWidthOrHeight_;
463     }
464 
GetCalendarDayFontSize()465     const Dimension& GetCalendarDayFontSize() const
466     {
467         return calendarDayFontSize_;
468     }
469 
GetDistanceBetweenContainterAndDate()470     const Dimension& GetDistanceBetweenContainterAndDate() const
471     {
472         return distanceBetweenContainterAndDate_;
473     }
474 
GetDistanceBetweenTitleAndDate()475     const Dimension& GetDistanceBetweenTitleAndDate() const
476     {
477         return distanceBetweenTitleAndDate_;
478     }
479 
GetCalendarContainerHeight()480     const Dimension& GetCalendarContainerHeight() const
481     {
482         return dalendarContainerHeight_;
483     }
484 
GetCalendarTitleFontSize()485     const Dimension& GetCalendarTitleFontSize() const
486     {
487         return calendarTitleFontSize_;
488     }
489 
GetCalendarTitleRowHeight()490     const Dimension& GetCalendarTitleRowHeight() const
491     {
492         return calendarTitleRowHeight_;
493     }
494 
GetCalendarTitleRowTopPadding()495     const Dimension& GetCalendarTitleRowTopPadding() const
496     {
497         return calendarTitleRowTopPadding_;
498     }
499 
GetCalendarTitleRowLeftRightPadding()500     const Dimension& GetCalendarTitleRowLeftRightPadding() const
501     {
502         return calendarTitleRowLeftRightPadding_;
503     }
504 
GetCalendarTitleTextPadding()505     const Dimension& GetCalendarTitleTextPadding() const
506     {
507         return calendarTitleTextPadding_;
508     }
509 
GetCalendarTitleImagePadding()510     const Dimension& GetCalendarTitleImagePadding() const
511     {
512         return calendarTitleImagePadding_;
513     }
514 
GetCalendarImageWidthHeight()515     const Dimension& GetCalendarImageWidthHeight() const
516     {
517         return calendarImageWidthHeight_;
518     }
519 
GetCalendarActionRowTopPadding()520     const Dimension& GetCalendarActionRowTopPadding() const
521     {
522         return calendarActionRowTopPadding_;
523     }
524 
GetCalendarActionRowBottomLeftRightPadding()525     const Dimension& GetCalendarActionRowBottomLeftRightPadding() const
526     {
527         return calendarActionRowBottomLeftRightPadding_;
528     }
529 
GetCalendarActionRowHeight()530     const Dimension& GetCalendarActionRowHeight() const
531     {
532         return calendarActionRowHeight_;
533     }
534 
GetCalendarDayRadius()535     const Dimension& GetCalendarDayRadius() const
536     {
537         return calendarDayRadius_;
538     }
539 
GetCalendarDayKeyFocusedWidth()540     const Dimension& GetCalendarDayKeyFocusedWidth() const
541     {
542         return calendarDayKeyFocusedWidth_;
543     }
544 
GetCalendarDayKeyFocusedPenWidth()545     const Dimension& GetCalendarDayKeyFocusedPenWidth() const
546     {
547         return calendarDayKeyFocusedPenWidth_;
548     }
549 
GetEntryFontSize()550     const Dimension& GetEntryFontSize() const
551     {
552         return entryFontSize_;
553     }
554 
GetDialogBorderRadius()555     const Dimension& GetDialogBorderRadius() const
556     {
557         return dialogBorderRadius_;
558     }
559 
GetDialogBackgroundColor()560     const Color& GetDialogBackgroundColor() const
561     {
562         return dialogBackgroundColor_;
563     }
564 
GetCalendarTitleFontColor()565     const Color& GetCalendarTitleFontColor() const
566     {
567         return calendarTitleFontColor_;
568     }
569 
GetTextCurrentMonthColor()570     const Color& GetTextCurrentMonthColor() const
571     {
572         return textCurrentMonthColor_;
573     }
574 
GetTextNonCurrentMonthColor()575     const Color& GetTextNonCurrentMonthColor() const
576     {
577         return textNonCurrentMonthColor_;
578     }
579 
GetTextSelectedDayColor()580     const Color& GetTextSelectedDayColor() const
581     {
582         return textSelectedDayColor_;
583     }
584 
GetTextCurrentDayColor()585     const Color& GetTextCurrentDayColor() const
586     {
587         return textCurrentDayColor_;
588     }
589 
GetBackgroundKeyFocusedColor()590     const Color& GetBackgroundKeyFocusedColor() const
591     {
592         return backgroundKeyFocusedColor_;
593     }
594 
GetBackgroundSelectedTodayColor()595     const Color& GetBackgroundSelectedTodayColor() const
596     {
597         return backgroundSelectedTodayColor_;
598     }
599 
GetBackgroundSelectedNotTodayColor()600     const Color& GetBackgroundSelectedNotTodayColor() const
601     {
602         return backgroundSelectedNotTodayColor_;
603     }
604 
GetBackgroundHoverColor()605     const Color& GetBackgroundHoverColor() const
606     {
607         return backgroundHoverColor_;
608     }
609 
GetBackgroundPressColor()610     const Color& GetBackgroundPressColor() const
611     {
612         return backgroundPressColor_;
613     }
614 
GetEntryFontColor()615     const Color& GetEntryFontColor() const
616     {
617         return entryFontColor_;
618     }
619 
GetDialogDividerColor()620     const Color& GetDialogDividerColor() const
621     {
622         return dialogDividerColor_;
623     }
624 
GetDialogButtonBackgroundColor()625     const Color& GetDialogButtonBackgroundColor() const
626     {
627         return dialogButtonBackgroundColor_;
628     }
629 protected:
630     CalendarTheme() = default;
631 
632 private:
633     CalendarThemeStructure calendarTheme_;
634     CalendarThemeStructure cardCalendarTheme_;
635     Color entryBorderColor_;
636     Color entryArrowColor_;
637     Color selectBackgroundColor_;
638     Color dialogBackgroundColor_;
639     Color calendarTitleFontColor_;
640     Color textCurrentMonthColor_;
641     Color textNonCurrentMonthColor_;
642     Color textSelectedDayColor_;
643     Color textCurrentDayColor_;
644     Color backgroundKeyFocusedColor_;
645     Color backgroundSelectedTodayColor_;
646     Color backgroundSelectedNotTodayColor_;
647     Color backgroundHoverColor_;
648     Color backgroundPressColor_;
649     Color entryFontColor_;
650     Color dialogDividerColor_;
651     Color dialogButtonBackgroundColor_;
652     Dimension entryHeight_;
653     Dimension entryBorderWidth_;
654     Dimension entryBorderRadius_;
655     Dimension entryButtonWidth_;
656     Dimension entryArrowHeight_;
657     Dimension entryArrowwidth_;
658     Dimension entryDateLeftRightMargin_;
659     Dimension entryDateTopBottomMargin_;
660     Dimension dialogMargin_;
661     Dimension calendarPickerDayWidthOrHeight_;
662     Dimension calendarDayFontSize_;
663     Dimension distanceBetweenContainterAndDate_;
664     Dimension distanceBetweenTitleAndDate_;
665     Dimension dalendarContainerHeight_;
666     Dimension calendarTitleFontSize_;
667     Dimension calendarTitleRowHeight_;
668     Dimension calendarTitleRowTopPadding_;
669     Dimension calendarTitleRowLeftRightPadding_;
670     Dimension calendarTitleTextPadding_;
671     Dimension calendarTitleImagePadding_;
672     Dimension calendarImageWidthHeight_;
673     Dimension calendarActionRowTopPadding_;
674     Dimension calendarActionRowBottomLeftRightPadding_;
675     Dimension calendarActionRowHeight_;
676     Dimension calendarDayRadius_;
677     Dimension calendarDayKeyFocusedWidth_;
678     Dimension calendarDayKeyFocusedPenWidth_;
679     Dimension entryFontSize_;
680     Dimension dialogBorderRadius_;
681 };
682 
683 } // namespace OHOS::Ace
684 
685 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_CALENDAR_CALENDAR_THEME_H
686