#pragma once #include "config.h" #include "imgui.h" #include #include #include #include "file_browser.h" #include #include using std::string; using namespace std::filesystem; struct ThemeStrings { string name; string description; ThemeStrings(); ThemeStrings(Json::Value config); }; struct AccentColorizer { /// @brief Whether or not to change the hue. bool Hue; /// @brief Whether or not to change the saturation. bool Saturation; /// @brief Whether or not to change the value. bool Value; /// @brief Whether or not to multiply the alpha. bool Alpha; /// @brief Colorizes a color stored as an ImVec4 according to preferences. void Colorize(ImVec4 accent, ImVec4 &color); /// @brief Serialize the settings to json. /// @returns The serialized JSON, as a Json::Value. Json::Value Serialize(); /// @brief Create a default accent colorizer AccentColorizer(); /// @brief Deserialize the settings from JSON and construct. /// @param json The JSON to deserialize from. AccentColorizer(Json::Value json); }; class Theme { ImGuiStyle style; public: static std::set availableThemes; static std::map themeStrings; static void updateAvailableThemes(); static path themeDir; static const char* prefPath; static const int MinSchemaVersion = 0; static const int MaxSchemaVersion = 1; string file_path; std::map strings; std::map AccentColorizers; ThemeStrings GetStrings(); static bool ShowEditor(bool *open, Theme* &theme, ImGuiID dockid, int window_width, int window_height); void Apply(ImVec4 accent); void Save(string path); void Save(path path); Theme(); Theme(bool dark); Theme(string path); Theme(path path); };