fix(graph): synchronize branch and chip colors
This commit is contained in:
@@ -583,7 +583,6 @@ float ref_badge_width(const RefBadge& badge) {
|
||||
}
|
||||
|
||||
void draw_ref_badge(const RefBadge& badge, int index, int lane) {
|
||||
(void)lane;
|
||||
const std::string display_name = ref_display_name(badge);
|
||||
|
||||
const bool show_cloud = badge.kind == RefKind::remote || badge.upstream;
|
||||
@@ -595,15 +594,15 @@ void draw_ref_badge(const RefBadge& badge, int index, int lane) {
|
||||
const ImVec2 minimum = ImGui::GetItemRectMin();
|
||||
const ImVec2 maximum = ImGui::GetItemRectMax();
|
||||
ImDrawList* draw = ImGui::GetWindowDrawList();
|
||||
ImU32 background = badge.current ? IM_COL32(17, 105, 123, 255) : IM_COL32(20, 65, 76, 255);
|
||||
if (ImGui::IsItemHovered()) background = badge.current
|
||||
? IM_COL32(22, 123, 142, 255) : IM_COL32(25, 79, 92, 255);
|
||||
ImU32 background = GraphRenderer::laneColor(lane, badge.current ? 205 : 135);
|
||||
if (ImGui::IsItemHovered()) background = GraphRenderer::laneColor(lane, badge.current ? 235 : 175);
|
||||
draw->AddRectFilled(minimum, maximum, background);
|
||||
draw->AddRect(minimum, maximum, GraphRenderer::laneColor(lane, 220));
|
||||
|
||||
float x = minimum.x + ui(6.0f);
|
||||
const float text_y = minimum.y + (chip_size.y - ImGui::GetFontSize()) * 0.5f;
|
||||
const float icon_y = minimum.y + (chip_size.y - g_outline_icon_size) * 0.5f;
|
||||
const ImU32 color = badge.current ? IM_COL32(242, 247, 249, 255) : IM_COL32(201, 214, 218, 255);
|
||||
const ImU32 color = badge.current ? IM_COL32(248, 250, 252, 255) : IM_COL32(224, 229, 234, 255);
|
||||
const auto draw_icon = [&](const char* icon) {
|
||||
if (!g_outline_icon_font) return;
|
||||
draw->AddText(g_outline_icon_font, g_outline_icon_size, {x, icon_y}, color, icon);
|
||||
|
||||
@@ -70,8 +70,9 @@ void GraphRenderer::drawRow(int row, const CommitInfo& commit,
|
||||
const float parent_x = origin.x + px(15.0f) + lane_spacing * parent->lane;
|
||||
const float child_y = center_y(child_row);
|
||||
const float parent_y = center_y(parent_row);
|
||||
const int edge_lane = child.lane == parent->lane ? child.lane : parent->lane;
|
||||
const ImU32 color = laneColor(edge_lane, 225);
|
||||
// An edge belongs to the branch it leaves, including the curved transition
|
||||
// into a parent lane, so its color stays consistent with the child node/ref chip.
|
||||
const ImU32 color = laneColor(child.lane, 225);
|
||||
if (child.lane == parent->lane) {
|
||||
draw->AddLine({child_x, child_y}, {parent_x, parent_y}, color, px(1.8f));
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user