Files
xiaozhi-esp32/main/display/lvgl_display/lvgl_theme.cc
Xiaoxia 57c2c64047 feat: Add gif support (#1183)
* feat: Add gif support

* fix: compiling errors

* fix remove bg image
2025-09-11 03:53:12 +08:00

31 lines
871 B
C++

#include "lvgl_theme.h"
LvglTheme::LvglTheme(const std::string& name) : Theme(name) {
}
lv_color_t LvglTheme::ParseColor(const std::string& color) {
if (color.find("#") == 0) {
// Convert #112233 to lv_color_t
uint8_t r = strtol(color.substr(1, 2).c_str(), nullptr, 16);
uint8_t g = strtol(color.substr(3, 2).c_str(), nullptr, 16);
uint8_t b = strtol(color.substr(5, 2).c_str(), nullptr, 16);
return lv_color_make(r, g, b);
}
return lv_color_black();
}
LvglThemeManager::LvglThemeManager() {
}
LvglTheme* LvglThemeManager::GetTheme(const std::string& theme_name) {
auto it = themes_.find(theme_name);
if (it != themes_.end()) {
return it->second;
}
return nullptr;
}
void LvglThemeManager::RegisterTheme(const std::string& theme_name, LvglTheme* theme) {
themes_[theme_name] = theme;
}