#pragma once #include #include #include #include #include // default is resolving to its value template std::string typeValueName(T V) { return std::to_string(static_cast>(V)); } // stores theming values and colors not expressed by imgui directly struct Theme { using key_type = entt::id_type; entt::dense_map colors; entt::dense_map colors_name; // TODO: spec out dependencies // TODO: what for entt::dense_map single_values; std::string name; // theme name Theme(void); // call when any color changed, so dependencies can be resolved void update(void); template void setColor(ImVec4 color) { constexpr auto key = entt::type_hash(V)>>::value(); colors[key] = color; if (!colors_name.contains(key)) { std::string key_name = static_cast( entt::type_name::value() ) + ":" + typeValueName(V); colors_name[key] = key_name; } } template ImVec4 getColor(void) const { constexpr auto key = entt::type_hash(V)>>::value(); const auto it = colors.find(key); if (it != colors.end()) { return it->second; } else { return {}; // TODO: pink as default? } } template std::string_view getColorName(void) const { constexpr auto key = entt::type_hash(V)>>::value(); if (colors_name.contains(key)) { return colors_name.at(key); } else { return "unk"; } } // TODO: actually serialize from config? bool load(void); bool store(void); }; Theme getDefaultThemeDark(void); Theme getDefaultThemeLight(void);