#pragma once #include #include #include #include #include #include namespace hex::api { class ThemeManager { public: constexpr static auto NativeTheme = "Native"; using ColorMap = std::map; struct Style { std::variant value; float min; float max; }; using StyleMap = std::map; static void changeTheme(std::string name); static void addTheme(const std::string &content); static void addThemeHandler(const std::string &name, const ColorMap &colorMap, const std::function &getFunction, const std::function &setFunction); static void addStyleHandler(const std::string &name, const StyleMap &styleMap); static std::vector getThemeNames(); static const std::string &getThemeImagePostfix(); static std::optional parseColorString(const std::string &colorString); static nlohmann::json exportCurrentTheme(const std::string &name); static void reset(); public: struct ThemeHandler { ColorMap colorMap; std::function getFunction; std::function setFunction; }; struct StyleHandler { StyleMap styleMap; }; static std::map& getThemeHandlers() { return s_themeHandlers; } static std::map& getStyleHandlers() { return s_styleHandlers; } private: ThemeManager() = default; static std::map s_themes; static std::map s_themeHandlers; static std::map s_styleHandlers; static std::string s_imagePostfix; static std::string s_currTheme; }; }