From fd4ad94f7d55357ee0f3794798dac9b69fa23b42 Mon Sep 17 00:00:00 2001 From: Bill Date: Mon, 9 Feb 2026 21:49:12 -0700 Subject: [PATCH] Step 173: theme gallery polish --- editor/src/panels/SettingsPanel.h | 29 +++++++++++++++++++++++++++++ editor/tests/step173_test.cpp | 1 + 2 files changed, 30 insertions(+) diff --git a/editor/src/panels/SettingsPanel.h b/editor/src/panels/SettingsPanel.h index 6c77a81..aa7830d 100644 --- a/editor/src/panels/SettingsPanel.h +++ b/editor/src/panels/SettingsPanel.h @@ -2,6 +2,20 @@ #include "../EditorState.h" #include "../EditorUtils.h" #include "../ThemeEngine.h" +#include + +static void openThemesFolder(const std::string& path) { +#ifdef _WIN32 + std::string cmd = "start \"\" \"" + path + "\""; + std::system(cmd.c_str()); +#elif __APPLE__ + std::string cmd = "open \"" + path + "\""; + std::system(cmd.c_str()); +#else + std::string cmd = "xdg-open \"" + path + "\""; + std::system(cmd.c_str()); +#endif +} static void renderSettingsPanel(EditorState& state) { if (!state.ui.showSettingsPanel) return; @@ -74,6 +88,17 @@ static void renderSettingsPanel(EditorState& state) { ImGui::SameLine(); ImGui::TextDisabled("Selected"); } + if (name == savedTheme) { + ImDrawList* draw = ImGui::GetWindowDrawList(); + ImVec2 pos = ImGui::GetWindowPos(); + ImVec2 size = ImGui::GetWindowSize(); + ImVec2 a(pos.x + size.x - 18.0f, pos.y + 10.0f); + ImVec2 b(pos.x + size.x - 12.0f, pos.y + 16.0f); + ImVec2 c(pos.x + size.x - 4.0f, pos.y + 6.0f); + ImU32 color = IM_COL32(80, 200, 120, 255); + draw->AddLine(a, b, color, 2.0f); + draw->AddLine(b, c, color, 2.0f); + } ImU32 swatch[4] = { IM_COL32(40, 40, 40, 255), @@ -144,6 +169,10 @@ static void renderSettingsPanel(EditorState& state) { ThemeEngine::instance().applyTheme(savedTheme); previewActive = false; } + ImGui::SameLine(); + if (ImGui::Button("Open Themes Folder")) { + openThemesFolder(ThemeEngine::userThemeDirectory()); + } } bool telemetryOptIn = state.settings.getTelemetryOptIn(); diff --git a/editor/tests/step173_test.cpp b/editor/tests/step173_test.cpp index 53e1d46..4895a7b 100644 --- a/editor/tests/step173_test.cpp +++ b/editor/tests/step173_test.cpp @@ -24,6 +24,7 @@ int main() { assertContains(settingsPanel, "Hover to preview"); assertContains(settingsPanel, "Apply"); assertContains(settingsPanel, "Reset"); + assertContains(settingsPanel, "Open Themes Folder"); printf("step173_test: all assertions passed\n"); return 0;