mirror of
https://github.com/hax4dazy/TinWoo.git
synced 2025-02-09 19:25:05 +01:00
Add files via upload
This commit is contained in:
parent
1861d563b0
commit
78a3f44113
27
include/util/theme.hpp
Normal file
27
include/util/theme.hpp
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <sstream>
|
||||||
|
#include <fstream>
|
||||||
|
#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));
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user