Skip to content

Commit

Permalink
fix promotion colors
Browse files Browse the repository at this point in the history
  • Loading branch information
forgottosave committed Nov 11, 2024
1 parent aef9889 commit 7d3fcbe
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/core/commit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 7d3fcbe

Please sign in to comment.