This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch fix/CAMEL-23934 in repository https://gitbox.apache.org/repos/asf/camel.git
commit dbcc443e7c5736cf9ef1e79e11312f41fa11745c Author: Claus Ibsen <[email protected]> AuthorDate: Wed Jul 8 11:34:25 2026 +0200 CAMEL-23934: Use darker green for throughput and history section titles Replace BRIGHT_GREEN in throughput sparkline with plain GREEN to match memory tab gauge. Replace Color.GREEN and Color.LIGHT_RED in history section titles (Body, Headers, Properties, Variables) and status indicators with Theme.success() and Theme.error() for better light theme readability. Co-Authored-By: Claude Opus 4.6 <[email protected]> Signed-off-by: Claus Ibsen <[email protected]> --- .../dsl/jbang/core/commands/tui/HistoryTab.java | 32 +++++++++++----------- .../dsl/jbang/core/commands/tui/OverviewTab.java | 7 ++--- .../core/commands/tui/HistoryTabRenderTest.java | 8 ++++-- 3 files changed, 24 insertions(+), 23 deletions(-) diff --git a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/HistoryTab.java b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/HistoryTab.java index 32831f574e56..319c4aa97625 100644 --- a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/HistoryTab.java +++ b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/HistoryTab.java @@ -914,7 +914,7 @@ class HistoryTab extends AbstractTab { stepSpans.add(Span.styled(" Step: ", Theme.label().bold())); stepSpans.add(Span.raw(String.format("%d/%d", stepIdx + 1, diagram.getHistoryStepCount()))); if (direction != null && !direction.isBlank()) { - Style dirStyle = failed ? Style.EMPTY.fg(Color.LIGHT_RED) : Style.EMPTY.fg(Color.GREEN); + Style dirStyle = failed ? Theme.error() : Theme.success(); stepSpans.add(Span.raw(" ")); stepSpans.add(Span.styled(direction, dirStyle)); } @@ -951,7 +951,7 @@ class HistoryTab extends AbstractTab { if (failed) { lines.add(Line.from( Span.styled(" Status: ", Theme.label().bold()), - Span.styled("Failed", Style.EMPTY.fg(Color.LIGHT_RED).bold()))); + Span.styled("Failed", Theme.error().bold()))); } // Compute BHPV change indicators @@ -981,12 +981,12 @@ class HistoryTab extends AbstractTab { if (exception != null && !exception.isBlank()) { lines.add(Line.from(Span.raw(""))); - lines.add(Line.from(Span.styled(" Exception", Style.EMPTY.fg(Color.LIGHT_RED).bold()))); + lines.add(Line.from(Span.styled(" Exception", Theme.error().bold()))); lines.add(Line.from(Span.raw(" " + exception))); } if (showBody && body != null) { - Style headerStyle = bodyChanged ? Theme.change().bold() : Style.EMPTY.fg(Color.GREEN).bold(); + Style headerStyle = bodyChanged ? Theme.change().bold() : Theme.success().bold(); lines.add(Line.from(Span.raw(""))); lines.add(Line.from( Span.styled(" Body", headerStyle), @@ -997,21 +997,21 @@ class HistoryTab extends AbstractTab { } if (showHeaders && headers != null && !headers.isEmpty()) { - Style sectionStyle = headersChanged ? Theme.change().bold() : Style.EMPTY.fg(Color.GREEN).bold(); + Style sectionStyle = headersChanged ? Theme.change().bold() : Theme.success().bold(); lines.add(Line.from(Span.raw(""))); lines.add(Line.from(Span.styled(" Headers", sectionStyle))); addInfoKvLines(lines, headers, headersChanged, prevHeaders); } if (showProps && properties != null && !properties.isEmpty()) { - Style sectionStyle = propsChanged ? Theme.change().bold() : Style.EMPTY.fg(Color.GREEN).bold(); + Style sectionStyle = propsChanged ? Theme.change().bold() : Theme.success().bold(); lines.add(Line.from(Span.raw(""))); lines.add(Line.from(Span.styled(" Properties", sectionStyle))); addInfoKvLines(lines, properties, propsChanged, prevProperties); } if (showVars && variables != null && !variables.isEmpty()) { - Style sectionStyle = varsChanged ? Theme.change().bold() : Style.EMPTY.fg(Color.GREEN).bold(); + Style sectionStyle = varsChanged ? Theme.change().bold() : Theme.success().bold(); lines.add(Line.from(Span.raw(""))); lines.add(Line.from(Span.styled(" Variables", sectionStyle))); addInfoKvLines(lines, variables, varsChanged, prevVariables); @@ -1194,8 +1194,8 @@ class HistoryTab extends AbstractTab { List<Row> rows = new ArrayList<>(); for (ExchangeSummary s : summaries) { Style statusStyle = switch (s.status) { - case "Done" -> Style.EMPTY.fg(Color.GREEN); - case "Failed" -> Style.EMPTY.fg(Color.LIGHT_RED); + case "Done" -> Theme.success(); + case "Failed" -> Theme.error(); case "Processing" -> Theme.warning(); default -> Style.EMPTY; }; @@ -1905,9 +1905,9 @@ class HistoryTab extends AbstractTab { String description, long elapsed, String changes) { Style dirStyle; if (first || last || !direction.isBlank()) { - dirStyle = failed ? Style.EMPTY.fg(Color.LIGHT_RED) : Style.EMPTY.fg(Color.GREEN); + dirStyle = failed ? Theme.error() : Theme.success(); } else { - dirStyle = failed ? Style.EMPTY.fg(Color.LIGHT_RED) : Style.EMPTY; + dirStyle = failed ? Theme.error() : Style.EMPTY; } String elapsedStr = elapsed >= 0 ? elapsed + "ms" : ""; String display = description != null ? description : (processor != null ? processor : ""); @@ -2015,7 +2015,7 @@ class HistoryTab extends AbstractTab { spans.add(Span.raw(" History of last completed — " + entries.size() + " steps (")); boolean failed = last.failed; spans.add(Span.styled("status:" + (failed ? "failed" : "success"), - failed ? Style.EMPTY.fg(Color.LIGHT_RED).bold() : Style.EMPTY.fg(Color.GREEN).bold())); + failed ? Theme.error().bold() : Theme.success().bold())); if (last.elapsed >= 0) { spans.add(Span.raw(" elapsed:" + TimeUtils.printDuration(last.elapsed, true))); } @@ -2050,7 +2050,7 @@ class HistoryTab extends AbstractTab { if (failed) { lines.add(Line.from( Span.styled(" Status: ", Theme.label().bold()), - Span.styled("Failed", Style.EMPTY.fg(Color.LIGHT_RED).bold()))); + Span.styled("Failed", Theme.error().bold()))); } lines.add(Line.from(Span.raw(""))); } @@ -2062,7 +2062,7 @@ class HistoryTab extends AbstractTab { if (map == null || map.isEmpty()) { return; } - Style headerStyle = changed ? Theme.change().bold() : Style.EMPTY.fg(Color.GREEN).bold(); + Style headerStyle = changed ? Theme.change().bold() : Theme.success().bold(); lines.add(Line.from(Span.styled(section, headerStyle))); for (Map.Entry<String, Object> entry : map.entrySet()) { String type = types != null ? types.get(entry.getKey()) : null; @@ -2096,7 +2096,7 @@ class HistoryTab extends AbstractTab { } static void addBodyLines(List<Line> lines, String body, String bodyType, boolean changed) { - Style headerStyle = changed ? Theme.change().bold() : Style.EMPTY.fg(Color.GREEN).bold(); + Style headerStyle = changed ? Theme.change().bold() : Theme.success().bold(); if (body != null) { if (bodyType != null) { lines.add(Line.from( @@ -2153,7 +2153,7 @@ class HistoryTab extends AbstractTab { if (exception == null) { return; } - lines.add(Line.from(Span.styled(" Exception:", Style.EMPTY.fg(Color.LIGHT_RED).bold()))); + lines.add(Line.from(Span.styled(" Exception:", Theme.error().bold()))); for (String l : exception.split("\n", -1)) { lines.add(Line.from(Span.raw(" " + TuiHelper.fixControlChars(l)))); } diff --git a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/OverviewTab.java b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/OverviewTab.java index e015bfd34af4..cc7d5f7f3f15 100644 --- a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/OverviewTab.java +++ b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/OverviewTab.java @@ -25,7 +25,6 @@ import java.util.Set; import dev.tamboui.layout.Constraint; import dev.tamboui.layout.Layout; import dev.tamboui.layout.Rect; -import dev.tamboui.style.AnsiColor; import dev.tamboui.style.Color; import dev.tamboui.style.Style; import dev.tamboui.terminal.Frame; @@ -525,14 +524,14 @@ class OverviewTab extends AbstractTab { Span.raw(" ["), Span.styled(chartName, Theme.label().bold()), Span.raw(String.format("] Throughput: %s msg/s ", curTpFmt)), - Span.styled("■", Style.EMPTY.fg(Color.ansi(AnsiColor.BRIGHT_GREEN))), + Span.styled("■", Style.EMPTY.fg(Color.GREEN)), Span.raw(String.format(" ok:%s ", curOkFmt)), Span.styled("■", Style.EMPTY.fg(Color.RED)), Span.raw(String.format(" fail:%s ", curFailFmt))); } else { titleLine = Line.from( Span.raw(String.format(" [All] Throughput: %s msg/s ", curTpFmt)), - Span.styled("■", Style.EMPTY.fg(Color.ansi(AnsiColor.BRIGHT_GREEN))), + Span.styled("■", Style.EMPTY.fg(Color.GREEN)), Span.raw(String.format(" ok:%s ", curOkFmt)), Span.styled("■", Style.EMPTY.fg(Color.RED)), Span.raw(String.format(" fail:%s ", curFailFmt))); @@ -547,7 +546,7 @@ class OverviewTab extends AbstractTab { long failed = Math.min(mergedFailed[i], mergedTotal[i]); long ok = Math.max(0, mergedTotal[i] - failed); groups.add(BarGroup.of( - Bar.builder().value(ok).textValue("").style(Style.EMPTY.fg(Color.ansi(AnsiColor.BRIGHT_GREEN))) + Bar.builder().value(ok).textValue("").style(Style.EMPTY.fg(Color.GREEN)) .build(), Bar.builder().value(failed).textValue("").style(Style.EMPTY.fg(Color.RED)).build())); } diff --git a/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/HistoryTabRenderTest.java b/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/HistoryTabRenderTest.java index 11c417683002..34a4ab861b62 100644 --- a/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/HistoryTabRenderTest.java +++ b/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/HistoryTabRenderTest.java @@ -100,8 +100,9 @@ class HistoryTabRenderTest { Frame frame = Frame.forTesting(buffer); tab.render(frame, area); - assertTrue(TuiTestHelper.findCellWithColor(buffer, "D", Color.GREEN), - "Done status should contain a cell rendered in GREEN"); + Color successColor = Theme.success().fg().orElse(Color.GREEN); + assertTrue(TuiTestHelper.findCellWithColor(buffer, "D", successColor), + "Done status should contain a cell rendered in success color"); } @Test @@ -116,7 +117,8 @@ class HistoryTabRenderTest { Frame frame = Frame.forTesting(buffer); tab.render(frame, area); - assertTrue(TuiTestHelper.findCellWithColor(buffer, "F", Color.LIGHT_RED), + Color errorColor = Theme.error().fg().orElse(Color.LIGHT_RED); + assertTrue(TuiTestHelper.findCellWithColor(buffer, "F", errorColor), "Failed status should contain a cell rendered in LIGHT_RED"); }
