From 3c23a16b42b0e17b5c496c4c39820c99d15f5548 Mon Sep 17 00:00:00 2001 From: Sam Nobs <3915450+samsta@users.noreply.github.com> Date: Sun, 19 Jun 2022 12:19:58 +1200 Subject: [PATCH] Browser: Tweak highlight color --- src/LiveMusicBrowser.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/LiveMusicBrowser.cpp b/src/LiveMusicBrowser.cpp index 121b3e7..1fc88c8 100644 --- a/src/LiveMusicBrowser.cpp +++ b/src/LiveMusicBrowser.cpp @@ -95,6 +95,8 @@ void drawBrowserList(const json11::Json& data) ImGui::Text("Browse Files:"); ImGuiTableFlags flags = ImGuiTableFlags_Borders | ImGuiTableFlags_RowBg | ImGuiTableFlags_SizingFixedFit; + const ImVec4 ROW_HIGHLIGHT_COLOR(ImColor::HSV(0, 0.0f, 1.0f, 0.5f)); + if (not data["rows"].is_null() and ImGui::BeginTable("tracks", data["cols"].array_items().size() - 1, flags)) { int key_distance_col_ix = -1; @@ -111,6 +113,8 @@ void drawBrowserList(const json11::Json& data) } ImGui::TableHeadersRow(); + ImGui::PushStyleColor(ImGuiCol_Header, ROW_HIGHLIGHT_COLOR); + bool needs_color_pop = false; for (int row_ix = 0; row_ix < data["rows"].array_items().size(); row_ix++) { @@ -132,7 +136,7 @@ void drawBrowserList(const json11::Json& data) const float green_hue = 0.23; float hue = green_hue - key_distance / 20; if (hue < 0) hue = 0; - ImVec4 row_color = (ImVec4)ImColor::HSV(hue, 1.0f, 0.6f); + ImVec4 row_color = (ImVec4)ImColor::HSV(hue, 1.0f, 0.4f); ImGui::PushStyleColor(ImGuiCol_TableRowBg, row_color); ImGui::PushStyleColor(ImGuiCol_TableRowBgAlt, row_color); needs_color_pop = true; @@ -164,10 +168,13 @@ void drawBrowserList(const json11::Json& data) } ImGui::EndTable(); + // these ones are for the key difference highlighting if (needs_color_pop) { ImGui::PopStyleColor(2); } + // this one is for ImGui::PushStyleColor(ImGuiCol_Header, ROW_HIGHLIGHT_COLOR); + ImGui::PopStyleColor(); } }