From 78a3f44113cd9e1aa40c1287f4df90180ac16c5b Mon Sep 17 00:00:00 2001 From: mrdude2478 Date: Fri, 29 Sep 2023 03:40:09 +0100 Subject: [PATCH] Add files via upload --- include/util/theme.hpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 include/util/theme.hpp diff --git a/include/util/theme.hpp b/include/util/theme.hpp new file mode 100644 index 0000000..d3f9a4b --- /dev/null +++ b/include/util/theme.hpp @@ -0,0 +1,27 @@ +#pragma once + +#include +#include +#include +#include "json.hpp" + +using json = nlohmann::json; + +namespace Theme { + void Load(); + std::string ThemeEntry(std::string key); + inline json GetRelativeJson(json j, std::string key) { + std::istringstream ss(key); + std::string token; + + while (std::getline(ss, token, '.') && j != nullptr) { + j = j[token]; + } + + return j; + } +} + +inline std::string operator ""_theme(const char* key, size_t size) { + return Theme::ThemeEntry(std::string(key, size)); +} \ No newline at end of file