From 7d3fcbeb994d8413bd4594be7fd1b56f9a980471 Mon Sep 17 00:00:00 2001 From: Timon Ensel Date: Mon, 11 Nov 2024 18:20:51 +0100 Subject: [PATCH] fix promotion colors --- src/core/commit.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/core/commit.cpp b/src/core/commit.cpp index 97ec85d..f09a738 100644 --- a/src/core/commit.cpp +++ b/src/core/commit.cpp @@ -49,10 +49,12 @@ Decorator PositionAndSize(int left, int top, int width, int height) { } /// Partially inspired from https://github.com/ArthurSonzogni/FTXUI/blob/main/src/ftxui/component/window.cpp -Element DefaultRenderState(const WindowRenderState& state, ftxui::Color selectedColor = Color::White) { +Element DefaultRenderState(const WindowRenderState& state, ftxui::Color selectedColor = Color::White, bool dimmable = true) { Element element = state.inner; - //if (!state.active) { - if (selectedColor == Color::White) { + if (! dimmable) { + selectedColor = Color::White; + } + if (selectedColor == Color::White & dimmable) { element |= dim; } else { element |= bold; @@ -161,10 +163,10 @@ class CommitComponentImpl : public ComponentBase, public WindowOptions { drag_ }; - if (commitPosition == ostreetui.getSelectedCommit()) { // selected - element = render ? render(state) : DefaultRenderState(state, ostreetui.getBranchColorMap().at(commit.branch)); + if (commitPosition == ostreetui.getSelectedCommit()) { // selected & not in promotion + element = render ? render(state) : DefaultRenderState(state, ostreetui.getBranchColorMap().at(commit.branch), ostreetui.getPromotionHash() != hash); } else { - element = render ? render(state) : DefaultRenderState(state); + element = render ? render(state) : DefaultRenderState(state, Color::White, ostreetui.getPromotionHash() != hash); } // Position and record the drawn area of the window.