@@ -97,10 +97,94 @@ bool EditorSystem::initialize(const JSON::json& systemData)
97
97
ImGui_ImplWin32_Init (Application::GetSingleton ()->getWindow ()->getWindowHandle ());
98
98
ImGui_ImplDX11_Init (RenderingDevice::GetSingleton ()->getDevice (), RenderingDevice::GetSingleton ()->getContext ());
99
99
100
- m_Themes.push_back (std::make_unique<DarkTheme>());
101
- m_Themes.push_back (std::make_unique<LightTheme>());
102
- m_CurrentTheme = m_Themes.front ().get ();
103
- m_CurrentTheme->apply ();
100
+ // --- Apply layout with default values ---
101
+ ImGui::StyleColorsDark ();
102
+
103
+ {
104
+ ImGuiStyle& style = ImGui::GetStyle ();
105
+ style.WindowPadding = ImVec2 (15 , 15 );
106
+ style.WindowRounding = 5 .0f ;
107
+ style.FramePadding = ImVec2 (5 , 5 );
108
+ style.FrameRounding = 4 .0f ;
109
+ style.ItemSpacing = ImVec2 (12 , 6 );
110
+ style.ItemInnerSpacing = ImVec2 (8 , 4 );
111
+ style.IndentSpacing = 25 .0f ;
112
+ style.ScrollbarSize = 15 .0f ;
113
+ style.ScrollbarRounding = 9 .0f ;
114
+ style.GrabMinSize = 5 .0f ;
115
+ style.GrabRounding = 3 .0f ;
116
+
117
+ ImVec4* colors = ImGui::GetStyle ().Colors ;
118
+ colors[ImGuiCol_Text] = ImVec4 (0 .80f , 0 .80f , 0 .83f , 1 .00f );
119
+ colors[ImGuiCol_TextDisabled] = ImVec4 (0 .24f , 0 .23f , 0 .29f , 1 .00f );
120
+ colors[ImGuiCol_WindowBg] = ImVec4 (0 .05f , 0 .05f , 0 .07f , 1 .00f );
121
+ colors[ImGuiCol_ChildBg] = ImVec4 (0 .07f , 0 .07f , 0 .09f , 1 .00f );
122
+ colors[ImGuiCol_PopupBg] = ImVec4 (0 .14f , 0 .14f , 0 .14f , 1 .00f );
123
+ colors[ImGuiCol_Border] = ImVec4 (0 .23f , 0 .23f , 0 .23f , 1 .00f );
124
+ colors[ImGuiCol_BorderShadow] = ImVec4 (0 .68f , 0 .63f , 0 .63f , 1 .00f );
125
+ colors[ImGuiCol_FrameBg] = ImVec4 (0 .10f , 0 .09f , 0 .12f , 1 .00f );
126
+ colors[ImGuiCol_FrameBgHovered] = ImVec4 (0 .24f , 0 .23f , 0 .29f , 1 .00f );
127
+ colors[ImGuiCol_FrameBgActive] = ImVec4 (0 .56f , 0 .56f , 0 .58f , 1 .00f );
128
+ colors[ImGuiCol_TitleBg] = ImVec4 (0 .10f , 0 .09f , 0 .12f , 1 .00f );
129
+ colors[ImGuiCol_TitleBgActive] = ImVec4 (0 .07f , 0 .07f , 0 .09f , 1 .00f );
130
+ colors[ImGuiCol_TitleBgCollapsed] = ImVec4 (1 .00f , 0 .98f , 0 .95f , 0 .75f );
131
+ colors[ImGuiCol_MenuBarBg] = ImVec4 (0 .10f , 0 .09f , 0 .12f , 1 .00f );
132
+ colors[ImGuiCol_ScrollbarBg] = ImVec4 (0 .10f , 0 .09f , 0 .12f , 1 .00f );
133
+ colors[ImGuiCol_ScrollbarGrab] = ImVec4 (0 .80f , 0 .80f , 0 .83f , 0 .31f );
134
+ colors[ImGuiCol_ScrollbarGrabHovered] = ImVec4 (0 .56f , 0 .56f , 0 .58f , 1 .00f );
135
+ colors[ImGuiCol_ScrollbarGrabActive] = ImVec4 (0 .06f , 0 .05f , 0 .07f , 1 .00f );
136
+ colors[ImGuiCol_CheckMark] = ImVec4 (0 .20f , 0 .68f , 0 .42f , 0 .83f );
137
+ colors[ImGuiCol_SliderGrab] = ImVec4 (0 .80f , 0 .80f , 0 .83f , 0 .31f );
138
+ colors[ImGuiCol_SliderGrabActive] = ImVec4 (0 .06f , 0 .05f , 0 .07f , 1 .00f );
139
+ colors[ImGuiCol_Button] = ImVec4 (0 .12f , 0 .43f , 0 .33f , 0 .88f );
140
+ colors[ImGuiCol_ButtonHovered] = ImVec4 (0 .20f , 0 .68f , 0 .42f , 0 .83f );
141
+ colors[ImGuiCol_ButtonActive] = ImVec4 (0 .56f , 0 .56f , 0 .58f , 1 .00f );
142
+ colors[ImGuiCol_Header] = ImVec4 (0 .20f , 0 .68f , 0 .42f , 0 .58f );
143
+ colors[ImGuiCol_HeaderHovered] = ImVec4 (0 .20f , 0 .68f , 0 .42f , 0 .83f );
144
+ colors[ImGuiCol_HeaderActive] = ImVec4 (0 .06f , 0 .05f , 0 .07f , 1 .00f );
145
+ colors[ImGuiCol_Separator] = ImVec4 (0 .43f , 0 .43f , 0 .50f , 0 .50f );
146
+ colors[ImGuiCol_SeparatorHovered] = ImVec4 (0 .20f , 0 .68f , 0 .42f , 0 .83f );
147
+ colors[ImGuiCol_SeparatorActive] = ImVec4 (0 .36f , 0 .75f , 0 .10f , 1 .00f );
148
+ colors[ImGuiCol_ResizeGrip] = ImVec4 (0 .00f , 0 .00f , 0 .00f , 0 .00f );
149
+ colors[ImGuiCol_ResizeGripHovered] = ImVec4 (0 .56f , 0 .56f , 0 .58f , 1 .00f );
150
+ colors[ImGuiCol_ResizeGripActive] = ImVec4 (0 .06f , 0 .05f , 0 .07f , 1 .00f );
151
+ colors[ImGuiCol_Tab] = ImVec4 (0 .18f , 0 .57f , 0 .58f , 0 .86f );
152
+ colors[ImGuiCol_TabHovered] = ImVec4 (0 .20f , 0 .68f , 0 .42f , 0 .83f );
153
+ colors[ImGuiCol_TabActive] = ImVec4 (0 .20f , 0 .68f , 0 .42f , 1 .00f );
154
+ colors[ImGuiCol_TabUnfocused] = ImVec4 (0 .14f , 0 .41f , 0 .42f , 0 .46f );
155
+ colors[ImGuiCol_TabUnfocusedActive] = ImVec4 (0 .14f , 0 .41f , 0 .42f , 1 .00f );
156
+ colors[ImGuiCol_DockingPreview] = ImVec4 (0 .00f , 1 .00f , 0 .21f , 0 .70f );
157
+ colors[ImGuiCol_DockingEmptyBg] = ImVec4 (0 .20f , 0 .20f , 0 .20f , 1 .00f );
158
+ colors[ImGuiCol_PlotLines] = ImVec4 (0 .40f , 0 .39f , 0 .38f , 0 .63f );
159
+ colors[ImGuiCol_PlotLinesHovered] = ImVec4 (0 .25f , 1 .00f , 0 .00f , 1 .00f );
160
+ colors[ImGuiCol_PlotHistogram] = ImVec4 (0 .40f , 0 .39f , 0 .38f , 0 .63f );
161
+ colors[ImGuiCol_PlotHistogramHovered] = ImVec4 (0 .25f , 1 .00f , 0 .00f , 1 .00f );
162
+ colors[ImGuiCol_TableHeaderBg] = ImVec4 (0 .19f , 0 .19f , 0 .20f , 1 .00f );
163
+ colors[ImGuiCol_TableBorderStrong] = ImVec4 (0 .31f , 0 .31f , 0 .35f , 1 .00f );
164
+ colors[ImGuiCol_TableBorderLight] = ImVec4 (0 .23f , 0 .23f , 0 .25f , 1 .00f );
165
+ colors[ImGuiCol_TableRowBg] = ImVec4 (0 .00f , 0 .00f , 0 .00f , 0 .00f );
166
+ colors[ImGuiCol_TableRowBgAlt] = ImVec4 (1 .00f , 1 .00f , 1 .00f , 0 .06f );
167
+ colors[ImGuiCol_TextSelectedBg] = ImVec4 (0 .25f , 1 .00f , 0 .00f , 0 .48f );
168
+ colors[ImGuiCol_DragDropTarget] = ImVec4 (1 .00f , 1 .00f , 0 .00f , 0 .90f );
169
+ colors[ImGuiCol_NavHighlight] = ImVec4 (1 .00f , 1 .00f , 1 .00f , 1 .00f );
170
+ colors[ImGuiCol_NavWindowingHighlight] = ImVec4 (1 .00f , 1 .00f , 1 .00f , 0 .70f );
171
+ colors[ImGuiCol_NavWindowingDimBg] = ImVec4 (0 .80f , 0 .80f , 0 .80f , 0 .20f );
172
+ colors[ImGuiCol_ModalWindowDimBg] = ImVec4 (1 .00f , 0 .98f , 0 .95f , 0 .73f );
173
+ }
174
+
175
+ // --- Load json theme data ---
176
+ for (const auto & entry : std::filesystem::directory_iterator (" editor/themes" ))
177
+ {
178
+ if (entry.path ().extension () == " .json" )
179
+ {
180
+ std::ifstream f (entry.path ());
181
+ nlohmann::json data;
182
+ f >> data;
183
+ m_ThemeDefinitions.push_back ({ data.value (" name" , entry.path ().stem ().string ()),
184
+ entry.path ().string (),
185
+ data });
186
+ }
187
+ }
104
188
105
189
return true ;
106
190
}
@@ -348,14 +432,13 @@ void EditorSystem::drawDefaultUI(float deltaMilliseconds)
348
432
static bool styleEditor = false ;
349
433
if (ImGui::BeginMenu (" View" ))
350
434
{
351
- if (ImGui::BeginMenu (" Theme " ))
435
+ if (ImGui::BeginMenu (" Themes " ))
352
436
{
353
- for (auto & theme : m_Themes )
437
+ for (size_t i = 0 ; i < m_ThemeDefinitions. size (); ++i )
354
438
{
355
- if (ImGui::MenuItem (theme-> getName (). c_str (), " " , m_CurrentTheme == theme. get ()))
439
+ if (ImGui::MenuItem (m_ThemeDefinitions[i]. m_Name . c_str ()))
356
440
{
357
- m_CurrentTheme = theme.get ();
358
- m_CurrentTheme->apply ();
441
+ m_ThemeDefinitions[i].apply ();
359
442
}
360
443
}
361
444
ImGui::EndMenu ();
0 commit comments