imjson
is a small C++ utility that allows theme definition for Dear ImGui through JSON files.
- Define ImGui style colors and variables using JSON objects
- Load themes from files, strings, or JSON objects
- Load fonts from JSON objects
- Proper style stack management
Include imjson.h
and imjson.cpp
in your project:
#include "imjson.h"
int main() {
imjson::load_file("my_theme.json");
// Or from a string
imjson::load_string(R"(
{
"Colors": {
"Text": [1.0, 0.0, 0.0, 1.0]
},
"Rounding": {
"WindowRounding": 8.0,
"FrameRounding": 4.0
},
"WindowPadding": [8, 8]
}
)");
imjson::pop_colors();
imjson::pop_vars();
}
A complete example is provided in the example/
directory. To build it:
mkdir build && cd build
cmake ..
cmake --build .
{
"Colors": {
"Text": [0.9, 0.9, 0.9, 1.0],
"WindowBg": [0.1, 0.1, 0.1, 1.0]
},
"Rounding": {
"WindowRounding": 4.0,
"FrameRounding": 2.0
},
"WindowPadding": [8, 8]
}