From 69d8ecc185394aac2281e2acd8e9621489d77250 Mon Sep 17 00:00:00 2001 From: Pascal Thomet Date: Sat, 15 Jun 2024 09:06:29 +0200 Subject: [PATCH] SetupDefaultImGuiStyle: do not override theme choice! --- src/hello_imgui/impl/imgui_default_settings.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/hello_imgui/impl/imgui_default_settings.cpp b/src/hello_imgui/impl/imgui_default_settings.cpp index 38e03a03..c33b70d7 100644 --- a/src/hello_imgui/impl/imgui_default_settings.cpp +++ b/src/hello_imgui/impl/imgui_default_settings.cpp @@ -73,16 +73,13 @@ void SetupDefaultImGuiConfig() void SetupDefaultImGuiStyle() { - auto& io = ImGui::GetIO(); - // Setup Dear ImGui style - ImGui::StyleColorsDark(); - // ImGui::StyleColorsClassic(); + // Note: a theme was already applied via ImGuiWindowParams.tweakedTheme // When viewports are enabled we tweak WindowRounding/WindowBg so platform windows // can look identical to regular ones. - ImGuiStyle& style = ImGui::GetStyle(); - if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable) + if (ImGui::GetIO().ConfigFlags & ImGuiConfigFlags_ViewportsEnable) { + ImGuiStyle& style = ImGui::GetStyle(); style.WindowRounding = 0.0f; style.Colors[ImGuiCol_WindowBg].w = 1.0f; }