@@ -106,17 +106,6 @@ bool Assets::InitializePartition() {
106
106
return checksum_valid_;
107
107
}
108
108
109
- lv_color_t Assets::ParseColor (const std::string& color) {
110
- if (color.find (" #" ) == 0 ) {
111
- // Convert #112233 to lv_color_t
112
- uint8_t r = strtol (color.substr (1 , 2 ).c_str (), nullptr , 16 );
113
- uint8_t g = strtol (color.substr (3 , 2 ).c_str (), nullptr , 16 );
114
- uint8_t b = strtol (color.substr (5 , 2 ).c_str (), nullptr , 16 );
115
- return lv_color_make (r, g, b);
116
- }
117
- return lv_color_black ();
118
- }
119
-
120
109
bool Assets::Apply () {
121
110
void * ptr = nullptr ;
122
111
size_t size = 0 ;
@@ -158,6 +147,7 @@ bool Assets::Apply() {
158
147
}
159
148
}
160
149
150
+ #ifdef HAVE_LVGL
161
151
auto & theme_manager = LvglThemeManager::GetInstance ();
162
152
auto light_theme = theme_manager.GetTheme (" light" );
163
153
auto dark_theme = theme_manager.GetTheme (" dark" );
@@ -180,7 +170,7 @@ bool Assets::Apply() {
180
170
181
171
cJSON* emoji_collection = cJSON_GetObjectItem (root, " emoji_collection" );
182
172
if (cJSON_IsArray (emoji_collection)) {
183
- auto custom_emoji_collection = std::make_shared<CustomEmojiCollection >();
173
+ auto custom_emoji_collection = std::make_shared<EmojiCollection >();
184
174
int emoji_count = cJSON_GetArraySize (emoji_collection);
185
175
for (int i = 0 ; i < emoji_count; i++) {
186
176
cJSON* emoji = cJSON_GetArrayItem (emoji_collection, i);
@@ -208,11 +198,11 @@ bool Assets::Apply() {
208
198
cJSON* background_color = cJSON_GetObjectItem (light_skin, " background_color" );
209
199
cJSON* background_image = cJSON_GetObjectItem (light_skin, " background_image" );
210
200
if (cJSON_IsString (text_color)) {
211
- light_theme->set_text_color (ParseColor (text_color->valuestring ));
201
+ light_theme->set_text_color (LvglTheme:: ParseColor (text_color->valuestring ));
212
202
}
213
203
if (cJSON_IsString (background_color)) {
214
- light_theme->set_background_color (ParseColor (background_color->valuestring ));
215
- light_theme->set_chat_background_color (ParseColor (background_color->valuestring ));
204
+ light_theme->set_background_color (LvglTheme:: ParseColor (background_color->valuestring ));
205
+ light_theme->set_chat_background_color (LvglTheme:: ParseColor (background_color->valuestring ));
216
206
}
217
207
if (cJSON_IsString (background_image)) {
218
208
if (!GetAssetData (background_image->valuestring , ptr, size)) {
@@ -229,11 +219,11 @@ bool Assets::Apply() {
229
219
cJSON* background_color = cJSON_GetObjectItem (dark_skin, " background_color" );
230
220
cJSON* background_image = cJSON_GetObjectItem (dark_skin, " background_image" );
231
221
if (cJSON_IsString (text_color)) {
232
- dark_theme->set_text_color (ParseColor (text_color->valuestring ));
222
+ dark_theme->set_text_color (LvglTheme:: ParseColor (text_color->valuestring ));
233
223
}
234
224
if (cJSON_IsString (background_color)) {
235
- dark_theme->set_background_color (ParseColor (background_color->valuestring ));
236
- dark_theme->set_chat_background_color (ParseColor (background_color->valuestring ));
225
+ dark_theme->set_background_color (LvglTheme:: ParseColor (background_color->valuestring ));
226
+ dark_theme->set_chat_background_color (LvglTheme:: ParseColor (background_color->valuestring ));
237
227
}
238
228
if (cJSON_IsString (background_image)) {
239
229
if (!GetAssetData (background_image->valuestring , ptr, size)) {
@@ -245,7 +235,8 @@ bool Assets::Apply() {
245
235
}
246
236
}
247
237
}
248
-
238
+ #endif
239
+
249
240
auto display = Board::GetInstance ().GetDisplay ();
250
241
ESP_LOGI (TAG, " Refreshing display theme..." );
251
242
display->SetTheme (display->GetTheme ());
0 commit comments