You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2026/07/08 13:18:55 UTC
(camel) 01/16: CAMEL-23934: Route all TUI colors through CSS tokens for theme support
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 22c2a5faf2b4bc9ad4c18087014694552369cdfa
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Wed Jul 8 11:29:06 2026 +0200
CAMEL-23934: Route all TUI colors through CSS tokens for theme support
Replace ~260 hardcoded Color.YELLOW/WHITE/DARK_GRAY usages with
semantic CSS tokens resolved via Theme.java so that adding a new
color theme only requires a new .tcss file with no Java changes.
Co-Authored-By: Claude Opus 4.6 <no...@anthropic.com>
Signed-off-by: Claus Ibsen <cl...@gmail.com>
---
.../dsl/jbang/core/commands/tui/AbstractTab.java | 3 +-
.../dsl/jbang/core/commands/tui/AiLogPopup.java | 4 +-
.../camel/dsl/jbang/core/commands/tui/AiPanel.java | 2 +-
.../dsl/jbang/core/commands/tui/BeansTab.java | 4 +-
.../dsl/jbang/core/commands/tui/BrowseTab.java | 8 +-
.../jbang/core/commands/tui/CamelCatalogTui.java | 16 +--
.../dsl/jbang/core/commands/tui/CamelMonitor.java | 2 +-
.../jbang/core/commands/tui/CircuitBreakerTab.java | 6 +-
.../dsl/jbang/core/commands/tui/ClasspathTab.java | 4 +-
.../dsl/jbang/core/commands/tui/DataSourceTab.java | 2 +-
.../dsl/jbang/core/commands/tui/DiagramTab.java | 8 +-
.../dsl/jbang/core/commands/tui/EndpointsTab.java | 12 +-
.../dsl/jbang/core/commands/tui/ErrorsTab.java | 14 +--
.../dsl/jbang/core/commands/tui/FilesBrowser.java | 2 +-
.../dsl/jbang/core/commands/tui/FolderBrowser.java | 2 +-
.../dsl/jbang/core/commands/tui/GotoTabPopup.java | 3 +-
.../dsl/jbang/core/commands/tui/HealthTab.java | 2 +-
.../jbang/core/commands/tui/HeapHistogramTab.java | 22 ++--
.../dsl/jbang/core/commands/tui/HistoryTab.java | 62 ++++-----
.../camel/dsl/jbang/core/commands/tui/HttpTab.java | 14 +--
.../dsl/jbang/core/commands/tui/InflightTab.java | 12 +-
.../dsl/jbang/core/commands/tui/InputHistory.java | 4 +-
.../camel/dsl/jbang/core/commands/tui/LogTab.java | 6 +-
.../core/commands/tui/MavenDependenciesTab.java | 4 +-
.../dsl/jbang/core/commands/tui/McpLogPopup.java | 2 +-
.../dsl/jbang/core/commands/tui/MemoryLeakTab.java | 54 ++++----
.../dsl/jbang/core/commands/tui/MemoryTab.java | 23 ++--
.../dsl/jbang/core/commands/tui/MetricsTab.java | 16 ++-
.../dsl/jbang/core/commands/tui/OverviewTab.java | 4 +-
.../dsl/jbang/core/commands/tui/PopupManager.java | 6 +-
.../jbang/core/commands/tui/RouteTreePreview.java | 6 +-
.../dsl/jbang/core/commands/tui/RoutesTab.java | 8 +-
.../jbang/core/commands/tui/SearchHighlighter.java | 6 +-
.../jbang/core/commands/tui/SendMessagePopup.java | 6 +-
.../dsl/jbang/core/commands/tui/SourceViewer.java | 4 +-
.../dsl/jbang/core/commands/tui/SpansTab.java | 16 +--
.../dsl/jbang/core/commands/tui/SqlQueryTab.java | 10 +-
.../dsl/jbang/core/commands/tui/SqlTraceTab.java | 8 +-
.../dsl/jbang/core/commands/tui/StartupTab.java | 1 -
.../camel/dsl/jbang/core/commands/tui/Theme.java | 139 ++++++++++++++++-----
.../dsl/jbang/core/commands/tui/ThreadsTab.java | 4 +-
.../dsl/jbang/core/commands/tui/TuiHelper.java | 6 +-
.../core/commands/tui/diagram/DiagramColors.java | 79 ++++++++----
.../commands/tui/diagram/RouteDiagramWidget.java | 21 ++--
.../tui/diagram/TopologyDiagramWidget.java | 35 +++---
.../tui/diagram/TopologyMinimapWidget.java | 8 +-
.../src/main/resources/tui/themes/dark.tcss | 15 +++
.../src/main/resources/tui/themes/light.tcss | 15 +++
.../commands/tui/CircuitBreakerTabRenderTest.java | 5 +-
.../jbang/core/commands/tui/HttpTabRenderTest.java | 5 +-
.../commands/tui/MonitorContextRenderTest.java | 14 ++-
.../core/commands/tui/MonitorContextTest.java | 8 +-
.../core/commands/tui/SearchHighlighterTest.java | 10 +-
.../core/commands/tui/SqlTraceTabRenderTest.java | 5 +-
54 files changed, 462 insertions(+), 295 deletions(-)
diff --git a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/AbstractTab.java b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/AbstractTab.java
index 56b4c7f39aef..f585f31e2eab 100644
--- a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/AbstractTab.java
+++ b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/AbstractTab.java
@@ -20,7 +20,6 @@ import java.util.ArrayList;
import java.util.List;
import dev.tamboui.layout.Rect;
-import dev.tamboui.style.Color;
import dev.tamboui.style.Style;
import dev.tamboui.terminal.Frame;
import dev.tamboui.text.Line;
@@ -113,7 +112,7 @@ abstract class AbstractTab implements MonitorTab {
protected static Style sortStyle(String column, String currentSort) {
return currentSort.equals(column)
- ? Style.EMPTY.fg(Color.YELLOW).bold()
+ ? Theme.label().bold()
: Style.EMPTY.bold();
}
diff --git a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/AiLogPopup.java b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/AiLogPopup.java
index b8272d17d9e8..a8d78a7f8a99 100644
--- a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/AiLogPopup.java
+++ b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/AiLogPopup.java
@@ -133,7 +133,7 @@ class AiLogPopup {
for (AiPanel.LogEntry entry : entries) {
Style levelStyle = switch (entry.level()) {
case QUESTION -> Style.EMPTY.fg(Color.CYAN);
- case TOOL -> Style.EMPTY.fg(Color.YELLOW);
+ case TOOL -> Theme.warning();
case RESULT -> Style.EMPTY.fg(Color.GREEN);
case RESPONSE -> Style.EMPTY.fg(Color.MAGENTA);
case ERROR -> Style.EMPTY.fg(Color.LIGHT_RED);
@@ -177,7 +177,7 @@ class AiLogPopup {
entry.level() == AiPanel.LogLevel.TOOL
? TuiIcons.ARROW_RIGHT + " Arguments"
: TuiIcons.ARROW_LEFT + " Result",
- Style.EMPTY.fg(entry.level() == AiPanel.LogLevel.TOOL ? Color.YELLOW : Color.GREEN).bold())));
+ (entry.level() == AiPanel.LogLevel.TOOL ? Theme.warning() : Style.EMPTY.fg(Color.GREEN)).bold())));
addJsonLines(lines, detail);
} else {
lines.add(Line.from(Span.styled(TuiIcons.ARROW_RIGHT + " Content",
diff --git a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/AiPanel.java b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/AiPanel.java
index d8b4e043d5fc..0b7ce4c1047f 100644
--- a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/AiPanel.java
+++ b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/AiPanel.java
@@ -744,7 +744,7 @@ class AiPanel {
Span.styled(" (in: ", dimStyle),
Span.styled(LlmClient.formatTokens(totalInput), Style.EMPTY.fg(Color.GREEN)),
Span.styled(" / out: ", dimStyle),
- Span.styled(LlmClient.formatTokens(totalOutput), Style.EMPTY.fg(Color.YELLOW)),
+ Span.styled(LlmClient.formatTokens(totalOutput), Theme.label()),
Span.styled(")", dimStyle)));
summaryLines.add(Line.from(
Span.styled("Avg latency: ", dimStyle),
diff --git a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/BeansTab.java b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/BeansTab.java
index 669179da31b5..c240d3202275 100644
--- a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/BeansTab.java
+++ b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/BeansTab.java
@@ -307,7 +307,7 @@ class BeansTab extends AbstractTableTab {
@Override
public void renderFooter(List<Span> spans) {
if (filterInputActive) {
- spans.add(Span.styled(" /", Style.EMPTY.fg(Color.YELLOW).bold()));
+ spans.add(Span.styled(" /", Theme.label().bold()));
spans.add(Span.raw(filterInputState.text() + "█ "));
hint(spans, "Enter", "filter");
hintLast(spans, "Esc", "cancel");
@@ -316,7 +316,7 @@ class BeansTab extends AbstractTableTab {
hint(spans, "Esc", filterTerm != null ? "clear" : "back");
hint(spans, "f", "scope [" + filterModes()[filterIndex] + "]");
if (filterTerm != null) {
- spans.add(Span.styled(" /", Style.EMPTY.fg(Color.YELLOW).bold()));
+ spans.add(Span.styled(" /", Theme.label().bold()));
spans.add(Span.raw("\"" + filterTerm + "\" "));
} else {
hint(spans, "/", "filter");
diff --git a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/BrowseTab.java b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/BrowseTab.java
index 929c2925554e..e0869ca3cc05 100644
--- a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/BrowseTab.java
+++ b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/BrowseTab.java
@@ -407,18 +407,18 @@ class BrowseTab extends AbstractTab {
List<Line> lines = new ArrayList<>();
lines.add(Line.from(
- Span.styled(" Exchange ID: ", Style.EMPTY.fg(Color.YELLOW).bold()),
+ Span.styled(" Exchange ID: ", Theme.label().bold()),
Span.styled(msg.exchangeId != null ? msg.exchangeId : "", Style.EMPTY.fg(Color.WHITE))));
if (msg.exchangePattern != null) {
lines.add(Line.from(
- Span.styled(" Pattern: ", Style.EMPTY.fg(Color.YELLOW).bold()),
+ Span.styled(" Pattern: ", Theme.label().bold()),
Span.styled(msg.exchangePattern, Style.EMPTY.fg(Color.WHITE))));
}
lines.add(Line.from(Span.raw("")));
// Headers
if (msg.headers != null && !msg.headers.isEmpty()) {
- lines.add(Line.from(Span.styled(" Headers:", Style.EMPTY.fg(Color.YELLOW).bold())));
+ lines.add(Line.from(Span.styled(" Headers:", Theme.label().bold())));
for (Map.Entry<String, String> entry : msg.headers.entrySet()) {
lines.add(Line.from(
Span.styled(" " + entry.getKey(), Style.EMPTY.fg(Color.CYAN)),
@@ -429,7 +429,7 @@ class BrowseTab extends AbstractTab {
}
// Body
- lines.add(Line.from(Span.styled(" Body:", Style.EMPTY.fg(Color.YELLOW).bold())));
+ lines.add(Line.from(Span.styled(" Body:", Theme.label().bold())));
if (msg.body != null && !msg.body.isEmpty()) {
String bodyText = msg.body;
if (prettyPrint) {
diff --git a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/CamelCatalogTui.java b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/CamelCatalogTui.java
index 38ff7e7fc326..b20e778539c4 100644
--- a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/CamelCatalogTui.java
+++ b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/CamelCatalogTui.java
@@ -641,19 +641,19 @@ public class CamelCatalogTui extends CamelCommand {
private void renderFooter(Frame frame, Rect area) {
Line footer = Line.from(
- Span.styled(" Type", Style.EMPTY.fg(Color.YELLOW).bold()),
+ Span.styled(" Type", Theme.label().bold()),
Span.raw(" name filter "),
- Span.styled("/", Style.EMPTY.fg(Color.YELLOW).bold()),
+ Span.styled("/", Theme.label().bold()),
Span.raw(" full-text "),
- Span.styled("Esc", Style.EMPTY.fg(Color.YELLOW).bold()),
+ Span.styled("Esc", Theme.label().bold()),
Span.raw(" clear/back/quit "),
- Span.styled("\u2191\u2193", Style.EMPTY.fg(Color.YELLOW).bold()),
+ Span.styled("\u2191\u2193", Theme.label().bold()),
Span.raw(" navigate "),
- Span.styled("\u2190\u2192", Style.EMPTY.fg(Color.YELLOW).bold()),
+ Span.styled("\u2190\u2192", Theme.label().bold()),
Span.raw("/"),
- Span.styled("Tab", Style.EMPTY.fg(Color.YELLOW).bold()),
+ Span.styled("Tab", Theme.label().bold()),
Span.raw(" panels "),
- Span.styled("PgUp/Dn", Style.EMPTY.fg(Color.YELLOW).bold()),
+ Span.styled("PgUp/Dn", Theme.label().bold()),
Span.raw(" scroll"));
frame.renderWidget(Paragraph.from(footer), area);
@@ -685,7 +685,7 @@ public class CamelCatalogTui extends CamelCommand {
currentSpans.add(Span.raw(" "));
}
- currentSpans.add(Span.styled(label, Style.EMPTY.fg(Color.YELLOW).bold()));
+ currentSpans.add(Span.styled(label, Theme.label().bold()));
// Apply special styling for certain values
Style valueStyle;
diff --git a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/CamelMonitor.java b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/CamelMonitor.java
index de71e4d94c70..fb4e422bbeeb 100644
--- a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/CamelMonitor.java
+++ b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/CamelMonitor.java
@@ -1393,7 +1393,7 @@ public class CamelMonitor extends CamelCommand {
}
private void computeTabBadges(String[] badgeTexts, Style[] badgeStyles) {
- Style yellow = Style.EMPTY.fg(Color.YELLOW).bold();
+ Style yellow = Theme.label();
Style cyan = Style.EMPTY.fg(Color.CYAN).bold();
Style red = Style.EMPTY.fg(Color.LIGHT_RED).bold();
for (int j = 0; j < badgeStyles.length; j++) {
diff --git a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/CircuitBreakerTab.java b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/CircuitBreakerTab.java
index 84b847027cb3..c097d8226c14 100644
--- a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/CircuitBreakerTab.java
+++ b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/CircuitBreakerTab.java
@@ -81,7 +81,7 @@ class CircuitBreakerTab extends AbstractTableTab {
Style stateStyle = switch (cb.state != null ? cb.state.toLowerCase() : "") {
case "closed" -> Style.EMPTY.fg(Color.GREEN);
case "open", "forced_open" -> Style.EMPTY.fg(Color.LIGHT_RED);
- default -> Style.EMPTY.fg(Color.YELLOW);
+ default -> Theme.warning();
};
String state = cb.state != null ? cb.state : "";
String pending = cb.bufferedCalls > 0 ? String.valueOf(cb.bufferedCalls) : "";
@@ -195,7 +195,7 @@ class CircuitBreakerTab extends AbstractTableTab {
Style closedBox = isClosed ? Style.EMPTY.fg(Color.GREEN).bold() : Style.EMPTY;
Style openBox = isOpen ? Style.EMPTY.fg(Color.LIGHT_RED).bold() : Style.EMPTY;
- Style halfOpenBox = !isClosed && !isOpen ? Style.EMPTY.fg(Color.YELLOW).bold() : Style.EMPTY;
+ Style halfOpenBox = !isClosed && !isOpen ? Theme.warning().bold() : Style.EMPTY;
Style lbl = Style.EMPTY.dim();
List<Line> lines = new ArrayList<>();
@@ -281,7 +281,7 @@ class CircuitBreakerTab extends AbstractTableTab {
if (rate >= 80) {
barColor = Style.EMPTY.fg(Color.LIGHT_RED);
} else if (rate >= 50) {
- barColor = Style.EMPTY.fg(Color.YELLOW);
+ barColor = Theme.warning();
} else {
barColor = Style.EMPTY.fg(Color.GREEN);
}
diff --git a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/ClasspathTab.java b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/ClasspathTab.java
index 265bf3ff2f3e..eeace73c5f96 100644
--- a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/ClasspathTab.java
+++ b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/ClasspathTab.java
@@ -277,7 +277,7 @@ class ClasspathTab extends AbstractTab {
@Override
public void renderFooter(List<Span> spans) {
if (filterInputActive) {
- spans.add(Span.styled(" /", Style.EMPTY.fg(Color.YELLOW).bold()));
+ spans.add(Span.styled(" /", Theme.label().bold()));
spans.add(Span.raw(filterInputState.text() + "█ "));
hint(spans, "Enter", "filter");
hintLast(spans, "Esc", "cancel");
@@ -286,7 +286,7 @@ class ClasspathTab extends AbstractTab {
hint(spans, "Esc", filterTerm != null ? "clear" : "back");
hint(spans, "f", "scope [" + SCOPES[scopeIndex] + "]");
if (filterTerm != null) {
- spans.add(Span.styled(" /", Style.EMPTY.fg(Color.YELLOW).bold()));
+ spans.add(Span.styled(" /", Theme.label().bold()));
spans.add(Span.raw("\"" + filterTerm + "\" "));
} else {
hint(spans, "/", "filter");
diff --git a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/DataSourceTab.java b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/DataSourceTab.java
index 726dd6aca8e5..560c9de13ffc 100644
--- a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/DataSourceTab.java
+++ b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/DataSourceTab.java
@@ -88,7 +88,7 @@ class DataSourceTab extends AbstractTableTab {
? Style.EMPTY.fg(Color.LIGHT_RED)
: Style.EMPTY.fg(Color.CYAN);
Style waitingStyle = waiters
- ? Style.EMPTY.fg(Color.YELLOW)
+ ? Theme.warning()
: Style.EMPTY;
String poolLabel = di.poolName != null ? di.poolName : (di.poolType != null ? di.poolType : "");
diff --git a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/DiagramTab.java b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/DiagramTab.java
index d1487bfb2e79..72c33876d30a 100644
--- a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/DiagramTab.java
+++ b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/DiagramTab.java
@@ -365,7 +365,7 @@ class DiagramTab extends AbstractTab {
if (info.name != null) {
title = Line.from(
Span.raw(" Topology ["),
- Span.styled(info.name, Style.EMPTY.fg(Color.YELLOW).bold()),
+ Span.styled(info.name, Theme.label().bold()),
Span.raw("] "));
} else {
title = Line.from(Span.raw(" Topology "));
@@ -426,7 +426,7 @@ class DiagramTab extends AbstractTab {
List<Line> lines = new ArrayList<>();
if (route != null) {
lines.add(Line.from(
- Span.styled(" Route: ", Style.EMPTY.fg(Color.YELLOW).bold()),
+ Span.styled(" Route: ", Theme.label().bold()),
Span.styled(route.routeId, Style.EMPTY.fg(Color.WHITE).bold())));
lines.add(Line.from(
Span.styled(" From: ", Style.EMPTY.dim()),
@@ -577,7 +577,7 @@ class DiagramTab extends AbstractTab {
String linkedRoute = diagram.findLinkedRouteId(drillDownRouteId);
if (linkedRoute != null && diagram.getRouteLayout(linkedRoute) != null) {
lines.add(Line.from(
- Span.styled(" ↵ ", Style.EMPTY.fg(Color.YELLOW).bold()),
+ Span.styled(" ↵ ", Theme.label().bold()),
Span.styled(linkedRoute, Style.EMPTY.fg(Color.WHITE))));
} else if (ln.treeNode != null && ln.treeNode.info.remote) {
String arrow = "from".equals(ln.type) ? " external → " : " → external";
@@ -872,7 +872,7 @@ class DiagramTab extends AbstractTab {
}
private Line buildBreadcrumbTitle() {
- Style nameStyle = Style.EMPTY.fg(Color.YELLOW).bold();
+ Style nameStyle = Theme.label().bold();
List<Span> spans = new ArrayList<>();
spans.add(Span.raw(" Route ["));
if (routeNavigationStack.isEmpty()) {
diff --git a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/EndpointsTab.java b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/EndpointsTab.java
index 605b1473c2b9..f2c70eae238c 100644
--- a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/EndpointsTab.java
+++ b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/EndpointsTab.java
@@ -221,7 +221,7 @@ class EndpointsTab extends AbstractTableTab {
Style dirStyle = switch (dir) {
case "in" -> Style.EMPTY.fg(Color.ansi(AnsiColor.BRIGHT_GREEN));
case "out" -> Style.EMPTY.fg(Color.CYAN);
- default -> Style.EMPTY.fg(Color.YELLOW);
+ default -> Theme.label();
};
String arrow = switch (dir) {
case "in" -> TuiIcons.KEY_RIGHT + " ";
@@ -480,7 +480,7 @@ class EndpointsTab extends AbstractTableTab {
flowLines.add(Line.from(
Span.styled(arrowStr, inStyle),
Span.raw(" "),
- Span.styled(box, Style.EMPTY.fg(Color.YELLOW).bold()),
+ Span.styled(box, Theme.label().bold()),
Span.raw(" "),
Span.styled(arrowStr, outStyle)));
flowLines.add(Line.from(
@@ -593,7 +593,7 @@ class EndpointsTab extends AbstractTableTab {
flowLines.add(Line.from(
Span.styled(arrowStr, inStyle),
Span.raw(" "),
- Span.styled(box, Style.EMPTY.fg(Color.YELLOW).bold()),
+ Span.styled(box, Theme.label().bold()),
Span.raw(" "),
Span.styled(arrowStr, outStyle)));
flowLines.add(Line.from(
@@ -634,7 +634,7 @@ class EndpointsTab extends AbstractTableTab {
Line chartTitle = Line.from(
Span.raw(" ["),
- Span.styled(uriLabel, Style.EMPTY.fg(Color.YELLOW)),
+ Span.styled(uriLabel, Theme.label().bold()),
Span.raw("] "),
Span.styled("▬", Style.EMPTY.fg(Color.ansi(AnsiColor.BRIGHT_GREEN))),
Span.raw(String.format(" in:%-4s ", MetricsCollector.formatThroughput(curIn))),
@@ -675,7 +675,7 @@ class EndpointsTab extends AbstractTableTab {
long curOut = outArr[renderPoints - 1];
Line chartTitle = Line.from(
- Span.styled("▬", Style.EMPTY.fg(Color.YELLOW)),
+ Span.styled("▬", Theme.label()),
Span.raw(String.format(" in:%-8s ", sizeToString(curIn))),
Span.styled("▬", Style.EMPTY.fg(Color.MAGENTA)),
Span.raw(String.format(" out:%-8s avg body", sizeToString(curOut))));
@@ -683,7 +683,7 @@ class EndpointsTab extends AbstractTableTab {
frame.renderWidget(DualSparkline.builder()
.topData(inArr)
.bottomData(outArr)
- .topStyle(Style.EMPTY.fg(Color.YELLOW))
+ .topStyle(Theme.label())
.bottomStyle(Style.EMPTY.fg(Color.MAGENTA))
.showYAxis(true)
.xLabels("-" + renderPoints + "s", "-" + (renderPoints * 3 / 4) + "s",
diff --git a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/ErrorsTab.java b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/ErrorsTab.java
index 870af7955c5d..105acb1296af 100644
--- a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/ErrorsTab.java
+++ b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/ErrorsTab.java
@@ -567,7 +567,7 @@ class ErrorsTab extends AbstractTableTab {
}
private Line buildErrorBreadcrumbTitle() {
- Style nameStyle = Style.EMPTY.fg(Color.YELLOW).bold();
+ Style nameStyle = Theme.label().bold();
List<Span> spans = new ArrayList<>();
spans.add(Span.styled(" Error [", Style.EMPTY.fg(Color.WHITE)));
var stack = diagram.getHistoryNavigationStack();
@@ -606,27 +606,27 @@ class ErrorsTab extends AbstractTableTab {
}
lines.add(Line.from(
- Span.styled(" Exchange: ", Style.EMPTY.fg(Color.YELLOW).bold()),
+ Span.styled(" Exchange: ", Theme.label().bold()),
Span.raw(ei.exchangeId != null ? ei.exchangeId : "")));
lines.add(Line.from(
- Span.styled(" Route: ", Style.EMPTY.fg(Color.YELLOW).bold()),
+ Span.styled(" Route: ", Theme.label().bold()),
Span.styled(ei.routeId != null ? ei.routeId : "", Style.EMPTY.fg(Color.CYAN))));
lines.add(Line.from(
- Span.styled(" Node: ", Style.EMPTY.fg(Color.YELLOW).bold()),
+ Span.styled(" Node: ", Theme.label().bold()),
Span.raw(ei.nodeId != null ? ei.nodeId : "")));
if (ei.elapsed >= 0) {
lines.add(Line.from(
- Span.styled(" Elapsed: ", Style.EMPTY.fg(Color.YELLOW).bold()),
+ Span.styled(" Elapsed: ", Theme.label().bold()),
Span.raw(ei.elapsed + "ms")));
}
if (ei.threadName != null) {
lines.add(Line.from(
- Span.styled(" Thread: ", Style.EMPTY.fg(Color.YELLOW).bold()),
+ Span.styled(" Thread: ", Theme.label().bold()),
Span.raw(ei.threadName)));
}
Style handledStyle = ei.handled ? Style.EMPTY.fg(Color.GREEN) : Style.EMPTY.fg(Color.LIGHT_RED).bold();
lines.add(Line.from(
- Span.styled(" Handled: ", Style.EMPTY.fg(Color.YELLOW).bold()),
+ Span.styled(" Handled: ", Theme.label().bold()),
Span.styled(ei.handled ? "true" : "false", handledStyle)));
if (ei.exceptionType != null) {
diff --git a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/FilesBrowser.java b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/FilesBrowser.java
index 2d19824247e5..3051004367c6 100644
--- a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/FilesBrowser.java
+++ b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/FilesBrowser.java
@@ -284,7 +284,7 @@ class FilesBrowser {
.block(Block.builder()
.borderType(BorderType.ROUNDED).borders(Borders.ALL)
.title(Title.from(Line
- .from(Span.styled(popupTitle, Style.EMPTY.fg(Color.YELLOW).bold()))))
+ .from(Span.styled(popupTitle, Theme.label().bold()))))
.build())
.build();
frame.renderStatefulWidget(list, popup, listState);
diff --git a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/FolderBrowser.java b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/FolderBrowser.java
index b176c318de12..22d74bbdabb8 100644
--- a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/FolderBrowser.java
+++ b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/FolderBrowser.java
@@ -354,7 +354,7 @@ class FolderBrowser {
.block(Block.builder()
.borderType(BorderType.ROUNDED).borders(Borders.ALL)
.title(Title.from(Line
- .from(Span.styled(popupTitle, Style.EMPTY.fg(Color.YELLOW).bold()))))
+ .from(Span.styled(popupTitle, Theme.label().bold()))))
.build())
.build();
frame.renderStatefulWidget(list, popup, listState);
diff --git a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/GotoTabPopup.java b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/GotoTabPopup.java
index 51dd457ce79e..3f42d8ef7980 100644
--- a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/GotoTabPopup.java
+++ b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/GotoTabPopup.java
@@ -20,7 +20,6 @@ import java.util.ArrayList;
import java.util.List;
import dev.tamboui.layout.Rect;
-import dev.tamboui.style.Color;
import dev.tamboui.style.Style;
import dev.tamboui.terminal.Frame;
import dev.tamboui.text.Line;
@@ -186,7 +185,7 @@ class GotoTabPopup {
items.add(ListItem.from(Line.from(Span.styled(sep, Style.EMPTY.dim()))));
Style normalStyle = Style.EMPTY;
- Style matchStyle = Style.EMPTY.fg(Color.YELLOW).bold();
+ Style matchStyle = Theme.label().bold();
Style dimStyle = Style.EMPTY.dim();
for (TabRegistry.TabEntry entry : filteredEntries) {
List<Span> spans = new ArrayList<>();
diff --git a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/HealthTab.java b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/HealthTab.java
index 5e6d7949b64b..ed50832c1ad3 100644
--- a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/HealthTab.java
+++ b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/HealthTab.java
@@ -103,7 +103,7 @@ class HealthTab extends AbstractTableTab {
stateStyle = Style.EMPTY.fg(Color.LIGHT_RED);
icon = TuiIcons.HEALTH_DOWN + " ";
} else {
- stateStyle = Style.EMPTY.fg(Color.YELLOW);
+ stateStyle = Theme.warning();
icon = TuiIcons.HEALTH_WARN + " ";
}
diff --git a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/HeapHistogramTab.java b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/HeapHistogramTab.java
index fbaa0efe5018..2c90a40f6a8f 100644
--- a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/HeapHistogramTab.java
+++ b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/HeapHistogramTab.java
@@ -193,15 +193,15 @@ class HeapHistogramTab extends AbstractTableTab {
// Class info
lines.add(Line.from(
- Span.styled(" Class: ", Style.EMPTY.fg(Color.YELLOW).bold()),
+ Span.styled(" Class: ", Theme.label().bold()),
Span.styled(className, Style.EMPTY.fg(Color.CYAN))));
lines.add(Line.from(
- Span.styled(" Package: ", Style.EMPTY.fg(Color.YELLOW).bold()),
+ Span.styled(" Package: ", Theme.label().bold()),
Span.styled(pkg.isEmpty() ? "(none)" : pkg, pkg.isEmpty() ? Style.EMPTY.dim() : Style.EMPTY.fg(Color.WHITE))));
lines.add(Line.from(
- Span.styled(" Instances: ", Style.EMPTY.fg(Color.YELLOW).bold()),
+ Span.styled(" Instances: ", Theme.label().bold()),
Span.styled(formatNumber(entry.instances), Style.EMPTY.fg(Color.WHITE)),
- Span.styled(" Bytes: ", Style.EMPTY.fg(Color.YELLOW).bold()),
+ Span.styled(" Bytes: ", Theme.label().bold()),
Span.styled(formatBytes(entry.bytes), Style.EMPTY.fg(Color.WHITE))));
// Package summary
@@ -218,14 +218,14 @@ class HeapHistogramTab extends AbstractTableTab {
}
lines.add(Line.from(Span.raw("")));
lines.add(Line.from(
- Span.styled(" Package Summary ", Style.EMPTY.fg(Color.YELLOW).bold()),
+ Span.styled(" Package Summary ", Theme.label().bold()),
Span.styled("(" + pkg + ")", Style.EMPTY.dim())));
lines.add(Line.from(
- Span.styled(" Classes: ", Style.EMPTY.fg(Color.YELLOW)),
+ Span.styled(" Classes: ", Theme.label()),
Span.styled(formatNumber(pkgClasses), Style.EMPTY.fg(Color.WHITE)),
- Span.styled(" Instances: ", Style.EMPTY.fg(Color.YELLOW)),
+ Span.styled(" Instances: ", Theme.label()),
Span.styled(formatNumber(pkgInstances), Style.EMPTY.fg(Color.WHITE)),
- Span.styled(" Bytes: ", Style.EMPTY.fg(Color.YELLOW)),
+ Span.styled(" Bytes: ", Theme.label()),
Span.styled(formatBytes(pkgBytes), Style.EMPTY.fg(Color.WHITE))));
}
@@ -235,12 +235,12 @@ class HeapHistogramTab extends AbstractTableTab {
lines.add(Line.from(Span.raw("")));
if (jar.groupId() != null) {
lines.add(Line.from(
- Span.styled(" JAR: ", Style.EMPTY.fg(Color.YELLOW).bold()),
+ Span.styled(" JAR: ", Theme.label().bold()),
Span.styled(jar.groupId() + ":" + jar.artifactId() + ":" + jar.version(),
Style.EMPTY.fg(Color.GREEN))));
} else {
lines.add(Line.from(
- Span.styled(" JAR: ", Style.EMPTY.fg(Color.YELLOW).bold()),
+ Span.styled(" JAR: ", Theme.label().bold()),
Span.styled(jar.display(), Style.EMPTY.fg(Color.GREEN))));
}
if (jar.fullPath() != null) {
@@ -256,7 +256,7 @@ class HeapHistogramTab extends AbstractTableTab {
} else if (isBuiltinClass(className)) {
lines.add(Line.from(Span.raw("")));
lines.add(Line.from(
- Span.styled(" JAR: ", Style.EMPTY.fg(Color.YELLOW).bold()),
+ Span.styled(" JAR: ", Theme.label().bold()),
Span.styled("JDK (built-in)", Style.EMPTY.fg(Color.GREEN))));
}
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 f7167163cf6f..32831f574e56 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
@@ -810,7 +810,7 @@ class HistoryTab extends AbstractTab {
}
private Line buildHistoryBreadcrumbTitle() {
- Style nameStyle = Style.EMPTY.fg(Color.YELLOW).bold();
+ Style nameStyle = Theme.label().bold();
List<Span> spans = new ArrayList<>();
spans.add(Span.styled(" History [", Style.EMPTY.fg(Color.WHITE)));
var stack = diagram.getHistoryNavigationStack();
@@ -911,7 +911,7 @@ class HistoryTab extends AbstractTab {
}
List<Span> stepSpans = new ArrayList<>();
- stepSpans.add(Span.styled(" Step: ", Style.EMPTY.fg(Color.YELLOW).bold()));
+ 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);
@@ -920,37 +920,37 @@ class HistoryTab extends AbstractTab {
}
lines.add(Line.from(stepSpans));
lines.add(Line.from(
- Span.styled(" Exchange: ", Style.EMPTY.fg(Color.YELLOW).bold()),
+ Span.styled(" Exchange: ", Theme.label().bold()),
Span.raw(exchangeId)));
lines.add(Line.from(
- Span.styled(" Route: ", Style.EMPTY.fg(Color.YELLOW).bold()),
+ Span.styled(" Route: ", Theme.label().bold()),
Span.styled(routeId != null ? routeId : "", Style.EMPTY.fg(Color.CYAN))));
lines.add(Line.from(
- Span.styled(" Node: ", Style.EMPTY.fg(Color.YELLOW).bold()),
+ Span.styled(" Node: ", Theme.label().bold()),
Span.raw(nodeId != null ? nodeId : "")));
if (processor != null) {
lines.add(Line.from(
- Span.styled(" Proc: ", Style.EMPTY.fg(Color.YELLOW).bold()),
+ Span.styled(" Proc: ", Theme.label().bold()),
Span.raw(processor.strip())));
}
if (elapsed >= 0) {
lines.add(Line.from(
- Span.styled(" Elapsed: ", Style.EMPTY.fg(Color.YELLOW).bold()),
+ Span.styled(" Elapsed: ", Theme.label().bold()),
Span.raw(elapsed + "ms")));
}
if (timestamp != null) {
lines.add(Line.from(
- Span.styled(" Time: ", Style.EMPTY.fg(Color.YELLOW).bold()),
+ Span.styled(" Time: ", Theme.label().bold()),
Span.raw(timestamp)));
}
if (threadName != null) {
lines.add(Line.from(
- Span.styled(" Thread: ", Style.EMPTY.fg(Color.YELLOW).bold()),
+ Span.styled(" Thread: ", Theme.label().bold()),
Span.raw(threadName)));
}
if (failed) {
lines.add(Line.from(
- Span.styled(" Status: ", Style.EMPTY.fg(Color.YELLOW).bold()),
+ Span.styled(" Status: ", Theme.label().bold()),
Span.styled("Failed", Style.EMPTY.fg(Color.LIGHT_RED).bold())));
}
@@ -967,7 +967,7 @@ class HistoryTab extends AbstractTab {
boolean varsChanged = changes.length() > 3 && changes.charAt(3) == 'V';
List<Span> changeSpans = new ArrayList<>();
- changeSpans.add(Span.styled(" Changed: ", Style.EMPTY.fg(Color.YELLOW).bold()));
+ changeSpans.add(Span.styled(" Changed: ", Theme.label().bold()));
if (!changes.isBlank()) {
changeSpans.addAll(buildChangeSpans(changes));
}
@@ -986,7 +986,7 @@ class HistoryTab extends AbstractTab {
}
if (showBody && body != null) {
- Style headerStyle = bodyChanged ? Style.EMPTY.fg(Color.YELLOW).bold() : Style.EMPTY.fg(Color.GREEN).bold();
+ Style headerStyle = bodyChanged ? Theme.change().bold() : Style.EMPTY.fg(Color.GREEN).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 ? Style.EMPTY.fg(Color.YELLOW).bold() : Style.EMPTY.fg(Color.GREEN).bold();
+ Style sectionStyle = headersChanged ? Theme.change().bold() : Style.EMPTY.fg(Color.GREEN).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 ? Style.EMPTY.fg(Color.YELLOW).bold() : Style.EMPTY.fg(Color.GREEN).bold();
+ Style sectionStyle = propsChanged ? Theme.change().bold() : Style.EMPTY.fg(Color.GREEN).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 ? Style.EMPTY.fg(Color.YELLOW).bold() : Style.EMPTY.fg(Color.GREEN).bold();
+ Style sectionStyle = varsChanged ? Theme.change().bold() : Style.EMPTY.fg(Color.GREEN).bold();
lines.add(Line.from(Span.raw("")));
lines.add(Line.from(Span.styled(" Variables", sectionStyle)));
addInfoKvLines(lines, variables, varsChanged, prevVariables);
@@ -1035,8 +1035,8 @@ class HistoryTab extends AbstractTab {
boolean keyChanged = sectionChanged && prevMap != null
&& (!prevMap.containsKey(entry.getKey())
|| !Objects.equals(prevMap.get(entry.getKey()), entry.getValue()));
- Style keyStyle = keyChanged ? Style.EMPTY.fg(Color.YELLOW) : Style.EMPTY.fg(Color.CYAN);
- Style valStyle = keyChanged ? Style.EMPTY.fg(Color.YELLOW) : Style.EMPTY;
+ Style keyStyle = keyChanged ? Theme.change() : Style.EMPTY.fg(Color.CYAN);
+ Style valStyle = keyChanged ? Theme.change() : Style.EMPTY;
lines.add(Line.from(
Span.styled(" " + entry.getKey(), keyStyle),
Span.raw(" = "),
@@ -1196,7 +1196,7 @@ class HistoryTab extends AbstractTab {
Style statusStyle = switch (s.status) {
case "Done" -> Style.EMPTY.fg(Color.GREEN);
case "Failed" -> Style.EMPTY.fg(Color.LIGHT_RED);
- case "Processing" -> Style.EMPTY.fg(Color.YELLOW);
+ case "Processing" -> Theme.warning();
default -> Style.EMPTY;
};
rows.add(Row.from(
@@ -1499,7 +1499,7 @@ class HistoryTab extends AbstractTab {
Style labelStyle = selected ? Style.EMPTY.fg(Color.CYAN).bold() : Style.EMPTY.fg(Color.CYAN);
return Line.from(
- Span.styled(indicator, Style.EMPTY.fg(Color.YELLOW).bold()),
+ Span.styled(indicator, Theme.label().bold()),
Span.styled(label, labelStyle),
Span.styled(bar, bandStyle),
Span.raw(" ".repeat(pad)),
@@ -1934,7 +1934,7 @@ class HistoryTab extends AbstractTab {
if (c == ' ') {
spans.add(Span.styled(String.valueOf(c), Style.EMPTY.dim()));
} else {
- spans.add(Span.styled(String.valueOf(c), Style.EMPTY.fg(Color.YELLOW)));
+ spans.add(Span.styled(String.valueOf(c), Theme.change()));
}
}
return spans;
@@ -2031,25 +2031,25 @@ class HistoryTab extends AbstractTab {
List<Line> lines, String exchangeId, String routeId,
String nodeId, String nodeLabel, String location, long elapsed, String threadName, boolean failed) {
lines.add(Line.from(
- Span.styled(" Exchange: ", Style.EMPTY.fg(Color.YELLOW).bold()),
+ Span.styled(" Exchange: ", Theme.label().bold()),
Span.raw(exchangeId != null ? exchangeId : "")));
lines.add(Line.from(
- Span.styled(" Route: ", Style.EMPTY.fg(Color.YELLOW).bold()),
+ Span.styled(" Route: ", Theme.label().bold()),
Span.raw(String.format("%-25s", routeId != null ? routeId : "")),
- Span.styled(" Node: ", Style.EMPTY.fg(Color.YELLOW).bold()),
+ Span.styled(" Node: ", Theme.label().bold()),
Span.raw(nodeId != null ? nodeId : ""),
Span.raw(nodeLabel != null ? " (" + nodeLabel + ")" : "")));
lines.add(Line.from(
- Span.styled(" Location: ", Style.EMPTY.fg(Color.YELLOW).bold()),
+ Span.styled(" Location: ", Theme.label().bold()),
Span.raw(location != null ? location : "")));
lines.add(Line.from(
- Span.styled(" Elapsed: ", Style.EMPTY.fg(Color.YELLOW).bold()),
+ Span.styled(" Elapsed: ", Theme.label().bold()),
Span.raw(elapsed >= 0 ? elapsed + "ms" : ""),
- Span.styled(" Thread: ", Style.EMPTY.fg(Color.YELLOW).bold()),
+ Span.styled(" Thread: ", Theme.label().bold()),
Span.raw(threadName != null ? threadName : "")));
if (failed) {
lines.add(Line.from(
- Span.styled(" Status: ", Style.EMPTY.fg(Color.YELLOW).bold()),
+ Span.styled(" Status: ", Theme.label().bold()),
Span.styled("Failed", Style.EMPTY.fg(Color.LIGHT_RED).bold())));
}
lines.add(Line.from(Span.raw("")));
@@ -2062,7 +2062,7 @@ class HistoryTab extends AbstractTab {
if (map == null || map.isEmpty()) {
return;
}
- Style headerStyle = changed ? Style.EMPTY.fg(Color.YELLOW).bold() : Style.EMPTY.fg(Color.GREEN).bold();
+ Style headerStyle = changed ? Theme.change().bold() : Style.EMPTY.fg(Color.GREEN).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;
@@ -2084,8 +2084,8 @@ class HistoryTab extends AbstractTab {
boolean keyChanged = changed && prevMap != null
&& (!prevMap.containsKey(entry.getKey())
|| !Objects.equals(prevMap.get(entry.getKey()), entry.getValue()));
- Style keyStyle = keyChanged ? Style.EMPTY.fg(Color.YELLOW) : Style.EMPTY.fg(Color.CYAN);
- Style valStyle = keyChanged ? Style.EMPTY.fg(Color.YELLOW) : Style.EMPTY;
+ Style keyStyle = keyChanged ? Theme.change() : Style.EMPTY.fg(Color.CYAN);
+ Style valStyle = keyChanged ? Theme.change() : Style.EMPTY;
lines.add(Line.from(
Span.styled(" " + typeLabel, Style.EMPTY.dim()),
Span.styled(entry.getKey(), keyStyle),
@@ -2096,7 +2096,7 @@ class HistoryTab extends AbstractTab {
}
static void addBodyLines(List<Line> lines, String body, String bodyType, boolean changed) {
- Style headerStyle = changed ? Style.EMPTY.fg(Color.YELLOW).bold() : Style.EMPTY.fg(Color.GREEN).bold();
+ Style headerStyle = changed ? Theme.change().bold() : Style.EMPTY.fg(Color.GREEN).bold();
if (body != null) {
if (bodyType != null) {
lines.add(Line.from(
diff --git a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/HttpTab.java b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/HttpTab.java
index 23d65ebbb0e6..40124a1356fc 100644
--- a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/HttpTab.java
+++ b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/HttpTab.java
@@ -1031,7 +1031,7 @@ class HttpTab extends AbstractTableTab {
titleStyle = Style.EMPTY.fg(Color.LIGHT_RED).bold();
} else if ("Sending...".equals(probeResponseStatus)) {
titleStr = " Sending... ";
- titleStyle = Style.EMPTY.fg(Color.YELLOW).bold();
+ titleStyle = Theme.warning().bold();
} else {
titleStr = " Response " + probeResponseStatus;
if (probeResponseElapsed > 0) {
@@ -1074,7 +1074,7 @@ class HttpTab extends AbstractTableTab {
// Header line
int colon = line.indexOf(": ");
lines.add(Line.from(
- Span.styled(line.substring(0, colon + 1), Style.EMPTY.fg(Color.YELLOW)),
+ Span.styled(line.substring(0, colon + 1), Theme.label()),
Span.raw(line.substring(colon + 1))));
} else {
lines.add(Line.from(Span.raw(line)));
@@ -1158,7 +1158,7 @@ class HttpTab extends AbstractTableTab {
return Style.EMPTY.fg(Color.CYAN).bold();
}
if (code >= 400 && code < 500) {
- return Style.EMPTY.fg(Color.YELLOW).bold();
+ return Theme.warning().bold();
}
if (code >= 500) {
return Style.EMPTY.fg(Color.LIGHT_RED).bold();
@@ -1214,7 +1214,7 @@ class HttpTab extends AbstractTableTab {
String m = method.split(",")[0].trim().toUpperCase(Locale.ENGLISH);
return switch (m) {
case "GET" -> Style.EMPTY.fg(Color.GREEN);
- case "POST" -> Style.EMPTY.fg(Color.YELLOW);
+ case "POST" -> Theme.label();
case "PUT" -> Style.EMPTY.fg(Color.CYAN);
case "DELETE" -> Style.EMPTY.fg(Color.LIGHT_RED);
case "PATCH" -> Style.EMPTY.fg(Color.rgb(0xFF, 0x80, 0x00));
@@ -1227,7 +1227,7 @@ class HttpTab extends AbstractTableTab {
spans.add(Span.raw(" HTTP Services [" + visible.size() + "]"));
if (info.httpServer != null) {
spans.add(Span.raw(" "));
- spans.add(Span.styled("Server: ", Style.EMPTY.fg(Color.YELLOW).bold()));
+ spans.add(Span.styled("Server: ", Theme.label().bold()));
spans.add(Span.styled(info.httpServer, Style.EMPTY.fg(Color.CYAN)));
}
long restCount = info.httpEndpoints.stream().filter(e -> e.fromRest && !e.specification).count();
@@ -1251,7 +1251,7 @@ class HttpTab extends AbstractTableTab {
}
if (mgmtCount > 0) {
spans.add(Span.raw(" "));
- spans.add(Span.styled("Mgmt: ", Style.EMPTY.fg(Color.YELLOW).dim()));
+ spans.add(Span.styled("Mgmt: ", Theme.label().dim()));
spans.add(Span.raw(mgmtCount + ""));
}
spans.add(Span.raw(" "));
@@ -1400,7 +1400,7 @@ class HttpTab extends AbstractTableTab {
return;
}
lines.add(Line.from(
- Span.styled(String.format(" %-10s ", label + ":"), Style.EMPTY.fg(Color.YELLOW).bold()),
+ Span.styled(String.format(" %-10s ", label + ":"), Theme.label().bold()),
Span.raw(value)));
}
diff --git a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/InflightTab.java b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/InflightTab.java
index 3bbad15dc01b..a86f58beb4d4 100644
--- a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/InflightTab.java
+++ b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/InflightTab.java
@@ -168,7 +168,7 @@ class InflightTab extends AbstractTableTab {
if (durationMs >= THRESHOLD_RED) {
return Style.EMPTY.fg(Color.LIGHT_RED).bold();
} else if (durationMs >= THRESHOLD_YELLOW) {
- return Style.EMPTY.fg(Color.YELLOW);
+ return Theme.warning();
}
return Style.EMPTY.fg(Color.GREEN);
}
@@ -191,16 +191,16 @@ class InflightTab extends AbstractTableTab {
sb.append(BAR_CHARS[partial]);
}
- Color color;
+ Style barStyle;
if (duration >= THRESHOLD_RED) {
- color = Color.LIGHT_RED;
+ barStyle = Style.EMPTY.fg(Color.LIGHT_RED);
} else if (duration >= THRESHOLD_YELLOW) {
- color = Color.YELLOW;
+ barStyle = Theme.warning();
} else {
- color = Color.GREEN;
+ barStyle = Style.EMPTY.fg(Color.GREEN);
}
- return Span.styled(sb.toString(), Style.EMPTY.fg(color));
+ return Span.styled(sb.toString(), barStyle);
}
private int sortExchange(InflightInfo a, InflightInfo b) {
diff --git a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/InputHistory.java b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/InputHistory.java
index c4cc50fe6f68..bdd49a02248c 100644
--- a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/InputHistory.java
+++ b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/InputHistory.java
@@ -20,8 +20,6 @@ import java.util.ArrayList;
import java.util.List;
import dev.tamboui.layout.Rect;
-import dev.tamboui.style.Color;
-import dev.tamboui.style.Style;
import dev.tamboui.terminal.Frame;
import dev.tamboui.text.Line;
import dev.tamboui.text.Span;
@@ -145,7 +143,7 @@ class InputHistory {
.highlightSymbol("")
.block(Block.builder()
.borderType(BorderType.ROUNDED)
- .title(Title.from(Line.from(Span.styled(" " + title + " ", Style.EMPTY.fg(Color.YELLOW).bold()))))
+ .title(Title.from(Line.from(Span.styled(" " + title + " ", Theme.label().bold()))))
.build())
.build();
frame.renderStatefulWidget(list, popup, listState);
diff --git a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/LogTab.java b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/LogTab.java
index 520d84b0ab3a..c31d393e8637 100644
--- a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/LogTab.java
+++ b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/LogTab.java
@@ -302,7 +302,7 @@ class LogTab extends AbstractTab {
if (hasNew) {
titleLine = Line.from(
Span.raw(logLabel + " "),
- Span.styled("(*)", Style.EMPTY.fg(Color.YELLOW).bold()),
+ Span.styled("(*)", Theme.label()),
Span.raw(" "));
} else {
titleLine = Line.from(Span.raw(logLabel + " "));
@@ -439,7 +439,7 @@ class LogTab extends AbstractTab {
ListWidget list = ListWidget.builder()
.items(
ListItem.from(" ERROR ").style(Style.EMPTY.fg(Color.LIGHT_RED)),
- ListItem.from(" WARN ").style(Style.EMPTY.fg(Color.YELLOW)),
+ ListItem.from(" WARN ").style(Theme.warning()),
ListItem.from(" INFO ").style(Style.EMPTY),
ListItem.from(" DEBUG ").style(Style.EMPTY.fg(Color.CYAN)),
ListItem.from(" TRACE ").style(Style.EMPTY.dim()))
@@ -644,7 +644,7 @@ class LogTab extends AbstractTab {
String message = m.group(7);
Style levelStyle = switch (level) {
case "ERROR", "FATAL" -> Style.EMPTY.fg(Color.RED);
- case "WARN" -> Style.EMPTY.fg(Color.YELLOW);
+ case "WARN" -> Theme.warning();
case "INFO" -> Style.EMPTY.fg(Color.GREEN);
case "DEBUG" -> Style.EMPTY.fg(Color.CYAN);
case "TRACE" -> Style.EMPTY.dim();
diff --git a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/MavenDependenciesTab.java b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/MavenDependenciesTab.java
index 87806f9a9a42..03d586e783c8 100644
--- a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/MavenDependenciesTab.java
+++ b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/MavenDependenciesTab.java
@@ -301,7 +301,7 @@ class MavenDependenciesTab extends AbstractTableTab {
@Override
public void renderFooter(List<Span> spans) {
if (filterInputActive) {
- spans.add(Span.styled(" /", Style.EMPTY.fg(Color.YELLOW).bold()));
+ spans.add(Span.styled(" /", Theme.label().bold()));
spans.add(Span.raw(filterInputState.text() + "█ "));
hint(spans, "Enter", "filter");
hintLast(spans, "Esc", "cancel");
@@ -316,7 +316,7 @@ class MavenDependenciesTab extends AbstractTableTab {
hint(spans, "t", transitiveMode ? "direct" : "transitive");
}
if (filterTerm != null) {
- spans.add(Span.styled(" /", Style.EMPTY.fg(Color.YELLOW).bold()));
+ spans.add(Span.styled(" /", Theme.label().bold()));
spans.add(Span.raw("\"" + filterTerm + "\" "));
} else {
hint(spans, "/", "filter");
diff --git a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/McpLogPopup.java b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/McpLogPopup.java
index 90e80c6ed204..d702ae611343 100644
--- a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/McpLogPopup.java
+++ b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/McpLogPopup.java
@@ -182,7 +182,7 @@ class McpLogPopup {
TuiMcpServer.LogEntry entry = entries.get(selected);
List<Line> lines = new ArrayList<>();
if (entry.requestBody() != null) {
- lines.add(Line.from(Span.styled(TuiIcons.ARROW_RIGHT + " Request", Style.EMPTY.fg(Color.YELLOW).bold())));
+ lines.add(Line.from(Span.styled(TuiIcons.ARROW_RIGHT + " Request", Theme.label().bold())));
addJsonLines(lines, entry.requestBody());
lines.add(Line.from(Span.raw("")));
}
diff --git a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/MemoryLeakTab.java b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/MemoryLeakTab.java
index de08309ea008..370ab6b124d1 100644
--- a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/MemoryLeakTab.java
+++ b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/MemoryLeakTab.java
@@ -240,23 +240,23 @@ class MemoryLeakTab extends AbstractTab {
lines.add(Line.from(Span.raw("")));
lines.add(Line.from(
Span.styled(" Press ", Style.EMPTY.dim()),
- Span.styled("R", Style.EMPTY.fg(Color.YELLOW).bold()),
+ Span.styled("R", Theme.label().bold()),
Span.styled(" to start a recording.", Style.EMPTY.dim())));
lines.add(Line.from(Span.raw("")));
lines.add(Line.from(
- Span.styled(" Duration: ", Style.EMPTY.fg(Color.YELLOW).bold()),
+ Span.styled(" Duration: ", Theme.label().bold()),
Span.styled(duration + "s", Style.EMPTY.fg(Color.WHITE)),
Span.styled(" (use ", Style.EMPTY.dim()),
- Span.styled("+", Style.EMPTY.fg(Color.YELLOW).bold()),
+ Span.styled("+", Theme.label().bold()),
Span.styled("/", Style.EMPTY.dim()),
- Span.styled("-", Style.EMPTY.fg(Color.YELLOW).bold()),
+ Span.styled("-", Theme.label().bold()),
Span.styled(" to adjust)", Style.EMPTY.dim())));
String modeLabel = recordingMode == RecordingMode.DUAL ? "dual" : "single";
lines.add(Line.from(
- Span.styled(" Mode: ", Style.EMPTY.fg(Color.YELLOW).bold()),
+ Span.styled(" Mode: ", Theme.label().bold()),
Span.styled("[" + modeLabel + "]", Style.EMPTY.fg(Color.WHITE)),
Span.styled(" (press ", Style.EMPTY.dim()),
- Span.styled("d", Style.EMPTY.fg(Color.YELLOW).bold()),
+ Span.styled("d", Theme.label().bold()),
Span.styled(" to toggle)", Style.EMPTY.dim())));
lines.add(Line.from(Span.raw("")));
if (recordingMode == RecordingMode.DUAL) {
@@ -319,18 +319,18 @@ class MemoryLeakTab extends AbstractTab {
lines.add(Line.from(Span.raw("")));
lines.add(Line.from(
- Span.styled(" Elapsed: ", Style.EMPTY.fg(Color.YELLOW).bold()),
+ Span.styled(" Elapsed: ", Theme.label().bold()),
Span.styled(elapsedSec + "s", Style.EMPTY.fg(Color.WHITE))));
lines.add(Line.from(
- Span.styled(" Remaining: ", Style.EMPTY.fg(Color.YELLOW).bold()),
+ Span.styled(" Remaining: ", Theme.label().bold()),
Span.styled(remainingSec + "s", Style.EMPTY.fg(Color.WHITE))));
lines.add(Line.from(
- Span.styled(" Duration: ", Style.EMPTY.fg(Color.YELLOW).bold()),
+ Span.styled(" Duration: ", Theme.label().bold()),
Span.styled(currentRecordingDuration + "s", Style.EMPTY.fg(Color.WHITE))));
lines.add(Line.from(Span.raw("")));
lines.add(Line.from(
Span.styled(" Press ", Style.EMPTY.dim()),
- Span.styled("X", Style.EMPTY.fg(Color.YELLOW).bold()),
+ Span.styled("X", Theme.label().bold()),
Span.styled(" to stop recording early and view results.", Style.EMPTY.dim())));
// progress bar
@@ -465,31 +465,31 @@ class MemoryLeakTab extends AbstractTab {
// Sample info
lines.add(Line.from(
- Span.styled(" Class: ", Style.EMPTY.fg(Color.YELLOW).bold()),
+ Span.styled(" Class: ", Theme.label().bold()),
Span.styled(entry.className != null ? entry.className : "unknown", Style.EMPTY.fg(Color.CYAN))));
List<Span> infoSpans = new ArrayList<>();
if (entry.count > 1) {
- infoSpans.add(Span.styled(" Count: ", Style.EMPTY.fg(Color.YELLOW).bold()));
+ infoSpans.add(Span.styled(" Count: ", Theme.label().bold()));
infoSpans.add(Span.styled(String.valueOf(entry.count), Style.EMPTY.fg(Color.WHITE)));
}
if (entry.sampledSize > 0) {
infoSpans.add(Span.styled(infoSpans.isEmpty() ? " Sampled: " : " Sampled: ",
- Style.EMPTY.fg(Color.YELLOW).bold()));
+ Theme.label().bold()));
infoSpans.add(Span.styled(formatBytes(entry.sampledSize), Style.EMPTY.fg(Color.WHITE)));
}
if (!infoSpans.isEmpty()) {
lines.add(Line.from(infoSpans));
}
lines.add(Line.from(
- Span.styled(" Age: ", Style.EMPTY.fg(Color.YELLOW).bold()),
+ Span.styled(" Age: ", Theme.label().bold()),
Span.styled(formatDuration(entry.objectAge), Style.EMPTY.fg(Color.WHITE))));
// Reference chain
if (entry.referenceChain != null && !entry.referenceChain.isEmpty()) {
lines.add(Line.from(Span.raw("")));
lines.add(Line.from(
- Span.styled(" Reference Chain (Object → GC Root):", Style.EMPTY.fg(Color.YELLOW).bold())));
+ Span.styled(" Reference Chain (Object → GC Root):", Theme.label().bold())));
for (int i = 0; i < entry.referenceChain.size(); i++) {
ChainLink link = entry.referenceChain.get(i);
@@ -510,7 +510,7 @@ class MemoryLeakTab extends AbstractTab {
if (entry.stackTrace != null && !entry.stackTrace.isEmpty()) {
lines.add(Line.from(Span.raw("")));
lines.add(Line.from(
- Span.styled(" Allocation Stack Trace:", Style.EMPTY.fg(Color.YELLOW).bold())));
+ Span.styled(" Allocation Stack Trace:", Theme.label().bold())));
for (StackEntry frame2 : entry.stackTrace) {
Style methodStyle = isJdkFrame(frame2.method) ? Style.EMPTY.dim() : Style.EMPTY.fg(Color.WHITE);
@@ -559,7 +559,7 @@ class MemoryLeakTab extends AbstractTab {
rightCell(run1, 10),
rightCell(run2, 10),
rightCell(growth, 8),
- Cell.from(Line.from(trendSpan, Span.styled(warn, Style.EMPTY.fg(Color.YELLOW))))));
+ Cell.from(Line.from(trendSpan, Span.styled(warn, Theme.warning())))));
}
if (rows.isEmpty()) {
@@ -618,17 +618,17 @@ class MemoryLeakTab extends AbstractTab {
List<Line> lines = new ArrayList<>();
lines.add(Line.from(
- Span.styled(" Class: ", Style.EMPTY.fg(Color.YELLOW).bold()),
+ Span.styled(" Class: ", Theme.label().bold()),
Span.styled(entry.className != null ? entry.className : "unknown", Style.EMPTY.fg(Color.CYAN))));
lines.add(Line.from(
- Span.styled(" Trend: ", Style.EMPTY.fg(Color.YELLOW).bold()),
+ Span.styled(" Trend: ", Theme.label().bold()),
trendSpan(entry.trend)));
lines.add(Line.from(
- Span.styled(" Run 1: ", Style.EMPTY.fg(Color.YELLOW).bold()),
+ Span.styled(" Run 1: ", Theme.label().bold()),
Span.styled(formatBytes(entry.baselineSampledSize) + " (" + entry.baselineCount + " samples)",
Style.EMPTY.fg(Color.WHITE))));
lines.add(Line.from(
- Span.styled(" Run 2: ", Style.EMPTY.fg(Color.YELLOW).bold()),
+ Span.styled(" Run 2: ", Theme.label().bold()),
Span.styled(formatBytes(entry.currentSampledSize) + " (" + entry.currentCount + " samples)",
Style.EMPTY.fg(Color.WHITE))));
if (entry.growthRatio > 0) {
@@ -636,13 +636,13 @@ class MemoryLeakTab extends AbstractTab {
? "~" + formatGrowthPercent(entry.growthRatio)
: formatGrowthPercent(entry.growthRatio);
lines.add(Line.from(
- Span.styled(" Growth: ", Style.EMPTY.fg(Color.YELLOW).bold()),
+ Span.styled(" Growth: ", Theme.label().bold()),
Span.styled(growthLabel,
entry.growthRatio > 1.3 ? Style.EMPTY.fg(Color.RED).bold() : Style.EMPTY.fg(Color.WHITE))));
}
if (entry.lowConfidence) {
lines.add(Line.from(
- Span.styled(" " + TuiIcons.HEALTH_WARN + " Low confidence: ", Style.EMPTY.fg(Color.YELLOW)),
+ Span.styled(" " + TuiIcons.HEALTH_WARN + " Low confidence: ", Theme.warning()),
Span.styled("sample counts are too low or diverge significantly", Style.EMPTY.dim())));
lines.add(Line.from(
Span.styled(" between runs. The growth percentage may not be reliable.", Style.EMPTY.dim())));
@@ -654,7 +654,7 @@ class MemoryLeakTab extends AbstractTab {
if (entry.referenceChain != null && !entry.referenceChain.isEmpty()) {
lines.add(Line.from(Span.raw("")));
lines.add(Line.from(
- Span.styled(" Reference Chain (Object -> GC Root):", Style.EMPTY.fg(Color.YELLOW).bold())));
+ Span.styled(" Reference Chain (Object -> GC Root):", Theme.label().bold())));
for (int i = 0; i < entry.referenceChain.size(); i++) {
ChainLink link = entry.referenceChain.get(i);
String prefix = i == entry.referenceChain.size() - 1 ? " └─ " : " ├─ ";
@@ -673,7 +673,7 @@ class MemoryLeakTab extends AbstractTab {
if (entry.stackTrace != null && !entry.stackTrace.isEmpty()) {
lines.add(Line.from(Span.raw("")));
lines.add(Line.from(
- Span.styled(" Allocation Stack Trace:", Style.EMPTY.fg(Color.YELLOW).bold())));
+ Span.styled(" Allocation Stack Trace:", Theme.label().bold())));
for (StackEntry se : entry.stackTrace) {
Style methodStyle = isJdkFrame(se.method) ? Style.EMPTY.dim() : Style.EMPTY.fg(Color.WHITE);
lines.add(Line.from(
@@ -708,10 +708,10 @@ class MemoryLeakTab extends AbstractTab {
}
return switch (trend) {
case "growing" -> Span.styled(TuiIcons.ARROW_UP + " leak!", Style.EMPTY.fg(Color.RED).bold());
- case "suspicious" -> Span.styled(TuiIcons.ARROW_UP + " leak?", Style.EMPTY.fg(Color.YELLOW).bold());
+ case "suspicious" -> Span.styled(TuiIcons.ARROW_UP + " leak?", Theme.warning());
case "stable" -> Span.styled(TuiIcons.ARROW_STABLE + " stable", Style.EMPTY.fg(Color.GREEN));
case "shrinking" -> Span.styled(TuiIcons.ARROW_DOWN, Style.EMPTY.dim());
- case "new" -> Span.styled("new", Style.EMPTY.fg(Color.YELLOW));
+ case "new" -> Span.styled("new", Theme.warning());
case "gone" -> Span.styled("gone", Style.EMPTY.dim());
default -> Span.styled(trend, Style.EMPTY.dim());
};
diff --git a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/MemoryTab.java b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/MemoryTab.java
index c48c27537eed..8f61f268379b 100644
--- a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/MemoryTab.java
+++ b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/MemoryTab.java
@@ -140,12 +140,13 @@ class MemoryTab extends AbstractTab {
if (info.heapMemCommitted > 0) {
long pctComm = info.heapMemUsed * 100 / info.heapMemCommitted;
String gaugeComm = buildGaugeBar(pctComm, 30);
- Color colorComm = pctComm >= 80 ? Color.LIGHT_RED : pctComm >= 60 ? Color.YELLOW : Color.GREEN;
+ Style colorComm = pctComm >= 80 ? Style.EMPTY.fg(Color.LIGHT_RED) : pctComm >= 60 ? Theme.warning()
+ : Style.EMPTY.fg(Color.GREEN);
List<Span> commSpans = new ArrayList<>();
commSpans.add(Span.styled(" committed: ", Style.EMPTY.dim()));
commSpans.add(Span.styled(String.format("%-10s", formatBytes(info.heapMemCommitted)), Style.EMPTY));
- commSpans.add(Span.styled(gaugeComm, Style.EMPTY.fg(colorComm)));
- commSpans.add(Span.styled(String.format(" %d%%", pctComm), Style.EMPTY.fg(colorComm).bold()));
+ commSpans.add(Span.styled(gaugeComm, colorComm));
+ commSpans.add(Span.styled(String.format(" %d%%", pctComm), colorComm.bold()));
if (info.heapMemMax <= 0 && trendSpan != null) {
commSpans.add(Span.raw(" "));
commSpans.add(trendSpan);
@@ -155,12 +156,13 @@ class MemoryTab extends AbstractTab {
if (info.heapMemMax > 0) {
long pctMax = info.heapMemUsed * 100 / info.heapMemMax;
String gaugeMax = buildGaugeBar(pctMax, 30);
- Color colorMax = pctMax >= 80 ? Color.LIGHT_RED : pctMax >= 60 ? Color.YELLOW : Color.GREEN;
+ Style colorMax = pctMax >= 80 ? Style.EMPTY.fg(Color.LIGHT_RED) : pctMax >= 60 ? Theme.warning()
+ : Style.EMPTY.fg(Color.GREEN);
List<Span> maxSpans = new ArrayList<>();
maxSpans.add(Span.styled(" max: ", Style.EMPTY.dim()));
maxSpans.add(Span.styled(String.format("%-10s", formatBytes(info.heapMemMax)), Style.EMPTY));
- maxSpans.add(Span.styled(gaugeMax, Style.EMPTY.fg(colorMax)));
- maxSpans.add(Span.styled(String.format(" %d%%", pctMax), Style.EMPTY.fg(colorMax).bold()));
+ maxSpans.add(Span.styled(gaugeMax, colorMax));
+ maxSpans.add(Span.styled(String.format(" %d%%", pctMax), colorMax.bold()));
if (trendSpan != null) {
maxSpans.add(Span.raw(" "));
maxSpans.add(trendSpan);
@@ -173,13 +175,14 @@ class MemoryTab extends AbstractTab {
if (info.oldGenUsed > 0) {
long oldPct = info.oldGenMax > 0 ? info.oldGenUsed * 100 / info.oldGenMax : 0;
String oldGauge = buildGaugeBar(oldPct, 30);
- Color oldColor = oldPct >= 80 ? Color.LIGHT_RED : oldPct >= 60 ? Color.YELLOW : Color.GREEN;
+ Style oldColor = oldPct >= 80 ? Style.EMPTY.fg(Color.LIGHT_RED) : oldPct >= 60 ? Theme.warning()
+ : Style.EMPTY.fg(Color.GREEN);
lines.add(Line.from(
Span.styled(" Old Gen: ", Style.EMPTY.dim()),
Span.styled(String.format("%-10s", formatBytes(info.oldGenUsed)), Style.EMPTY.fg(Color.WHITE).bold()),
- Span.styled(oldGauge, Style.EMPTY.fg(oldColor)),
- Span.styled(String.format(" %d%%", oldPct), Style.EMPTY.fg(oldColor).bold())));
+ Span.styled(oldGauge, oldColor),
+ Span.styled(String.format(" %d%%", oldPct), oldColor.bold())));
lines.add(Line.from(
Span.styled(" committed: ", Style.EMPTY.dim()),
Span.raw(formatBytes(info.oldGenCommitted)),
@@ -294,7 +297,7 @@ class MemoryTab extends AbstractTab {
int greenEighths = (int) Math.round(0.6 * chartH * 8.0);
int yellowEighths = (int) Math.round(0.8 * chartH * 8.0);
Style greenStyle = Style.EMPTY.fg(Color.GREEN);
- Style yellowStyle = Style.EMPTY.fg(Color.YELLOW);
+ Style yellowStyle = Theme.warning();
Style redStyle = Style.EMPTY.fg(Color.LIGHT_RED);
for (int col = 0; col < chartW; col++) {
diff --git a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/MetricsTab.java b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/MetricsTab.java
index 81a054bd47c8..7b4c900f7f4e 100644
--- a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/MetricsTab.java
+++ b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/MetricsTab.java
@@ -62,7 +62,6 @@ class MetricsTab extends AbstractTableTab {
private static final Style LABEL = Style.EMPTY.dim();
private static final Style VALUE = Style.EMPTY.fg(Color.WHITE).bold();
- private static final Style HEADER = Style.EMPTY.fg(Color.YELLOW).bold();
private static final Style GOOD = Style.EMPTY.fg(Color.GREEN);
private static final Style BAD = Style.EMPTY.fg(Color.LIGHT_RED);
@@ -276,7 +275,7 @@ class MetricsTab extends AbstractTableTab {
List<Line> lines = new ArrayList<>();
// Exchanges section
- lines.add(Line.from(Span.styled(" Exchanges", HEADER)));
+ lines.add(Line.from(Span.styled(" Exchanges", Theme.label().bold())));
lines.add(Line.empty());
long total = counterValue(meters, "camel.exchanges.total");
@@ -305,7 +304,7 @@ class MetricsTab extends AbstractTableTab {
// Route timers
List<MicrometerMeterInfo> routeTimers = findMeters(meters, "camel.route.policy");
if (!routeTimers.isEmpty()) {
- lines.add(Line.from(Span.styled(" Route Timers", HEADER),
+ lines.add(Line.from(Span.styled(" Route Timers", Theme.label().bold()),
Span.styled(" mean / max", LABEL)));
lines.add(Line.empty());
for (MicrometerMeterInfo rt : routeTimers) {
@@ -331,7 +330,7 @@ class MetricsTab extends AbstractTableTab {
List<MicrometerMeterInfo> eventTimers = findMeters(meters, "camel.exchange.event.notifier");
if (!eventTimers.isEmpty()) {
lines.add(Line.empty());
- lines.add(Line.from(Span.styled(" Event Notifiers", HEADER),
+ lines.add(Line.from(Span.styled(" Event Notifiers", Theme.label().bold()),
Span.styled(" mean / max", LABEL)));
lines.add(Line.empty());
for (MicrometerMeterInfo et : eventTimers) {
@@ -359,7 +358,7 @@ class MetricsTab extends AbstractTableTab {
List<Line> lines = new ArrayList<>();
// Memory section
- lines.add(Line.from(Span.styled(" Memory", HEADER)));
+ lines.add(Line.from(Span.styled(" Memory", Theme.label().bold())));
lines.add(Line.empty());
double heapUsed = gaugeValue(meters, "jvm.memory.used", "area", "heap");
@@ -390,7 +389,7 @@ class MetricsTab extends AbstractTableTab {
lines.add(Line.empty());
// Runtime section
- lines.add(Line.from(Span.styled(" Runtime", HEADER)));
+ lines.add(Line.from(Span.styled(" Runtime", Theme.label().bold())));
lines.add(Line.empty());
double cpuProcess = gaugeValue(meters, "process.cpu.usage");
@@ -431,7 +430,7 @@ class MetricsTab extends AbstractTableTab {
List<MicrometerMeterInfo> gcTimers = findMeters(meters, "jvm.gc.pause");
if (!gcTimers.isEmpty()) {
lines.add(Line.empty());
- lines.add(Line.from(Span.styled(" Garbage Collection", HEADER)));
+ lines.add(Line.from(Span.styled(" Garbage Collection", Theme.label().bold())));
lines.add(Line.empty());
for (MicrometerMeterInfo gc : gcTimers) {
String cause = tagValue(gc, "cause");
@@ -645,7 +644,6 @@ class MetricsTab extends AbstractTableTab {
private static final Style PROM_COMMENT = Style.EMPTY.dim();
private static final Style PROM_NAME = Style.EMPTY.fg(Color.CYAN);
private static final Style PROM_VALUE = Style.EMPTY.fg(Color.WHITE).bold();
- private static final Style PROM_TAGS = Style.EMPTY.fg(Color.YELLOW);
private static Line colorPrometheusLine(String line) {
if (line.startsWith("#")) {
@@ -660,7 +658,7 @@ class MetricsTab extends AbstractTableTab {
String rest = line.substring(braceEnd + 1).trim();
return Line.from(
Span.styled(name, PROM_NAME),
- Span.styled(tags, PROM_TAGS),
+ Span.styled(tags, Theme.label()),
Span.styled(" " + rest, PROM_VALUE));
}
// name value (no tags)
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 b3c6195f9d03..e015bfd34af4 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
@@ -330,7 +330,7 @@ class OverviewTab extends AbstractTab {
List<Span> nameSpans = new ArrayList<>();
nameSpans.add(Span.styled(nameText, Theme.info()));
if (info.devMode) {
- nameSpans.add(Span.styled(" [dev]", Style.EMPTY.fg(Color.YELLOW).dim()));
+ nameSpans.add(Span.styled(" [dev]", Theme.label()));
}
if (hasDoc) {
nameSpans.add(Span.styled(" " + TuiIcons.README, Style.EMPTY));
@@ -523,7 +523,7 @@ class OverviewTab extends AbstractTab {
: ctx.selectedPid != null ? ctx.selectedPid : "?";
titleLine = Line.from(
Span.raw(" ["),
- Span.styled(chartName, Style.EMPTY.fg(Color.YELLOW)),
+ 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.raw(String.format(" ok:%s ", curOkFmt)),
diff --git a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/PopupManager.java b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/PopupManager.java
index d18cf7ab33e3..9070d677be89 100644
--- a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/PopupManager.java
+++ b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/PopupManager.java
@@ -410,7 +410,7 @@ class PopupManager {
frame.renderWidget(Clear.INSTANCE, popup);
- Style keyStyle = Style.EMPTY.fg(Color.YELLOW).bold();
+ Style keyStyle = Theme.label().bold();
ListItem[] items = morePopupItems(keyStyle);
ListWidget list = ListWidget.builder()
.items(items)
@@ -421,7 +421,7 @@ class PopupManager {
.borderType(BorderType.ROUNDED).borders(Borders.ALL)
.title(Title.from(Line.from(Span.styled(
" " + TuiIcons.TAB_MORE + " More Tabs ",
- Style.EMPTY.fg(Color.YELLOW).bold()))))
+ Theme.label().bold()))))
.build())
.build();
frame.renderStatefulWidget(list, popup, morePopupState);
@@ -492,7 +492,7 @@ class PopupManager {
.block(Block.builder()
.borderType(BorderType.ROUNDED).borders(Borders.ALL)
.title(Title.from(
- Line.from(Span.styled(" Switch Integration ", Style.EMPTY.fg(Color.YELLOW).bold()))))
+ Line.from(Span.styled(" Switch Integration ", Theme.label().bold()))))
.build())
.build();
frame.renderStatefulWidget(listWidget, popup, switchPopupState);
diff --git a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/RouteTreePreview.java b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/RouteTreePreview.java
index 83a43a19b2a0..0ee4dd84c3f9 100644
--- a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/RouteTreePreview.java
+++ b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/RouteTreePreview.java
@@ -102,7 +102,7 @@ class RouteTreePreview {
boolean selected = (node == selectedNode);
List<Span> spans = new ArrayList<>();
- spans.add(Span.styled(prefix, Style.EMPTY.fg(Color.DARK_GRAY)));
+ spans.add(Span.styled(prefix, Theme.muted()));
spans.add(styledLabel(node.info.type, truncate(label, maxWidth - prefix.length()), selected));
result.add(Line.from(spans));
lineNodes.add(node);
@@ -111,14 +111,14 @@ class RouteTreePreview {
private static Span styledLabel(String type, String text, boolean selected) {
Style style;
if ("from".equals(type)) {
- style = Style.EMPTY.fg(Color.YELLOW);
+ style = Theme.label();
} else if (STRUCTURAL_TYPES.contains(type)) {
style = Style.EMPTY.fg(Color.CYAN);
} else {
style = Style.EMPTY;
}
if (selected) {
- style = Style.EMPTY.fg(Color.YELLOW).bold().bg(Color.DARK_GRAY);
+ style = Theme.selectionBg();
}
return Span.styled(text, style);
}
diff --git a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/RoutesTab.java b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/RoutesTab.java
index 4e8606e844fb..e3f64d4401eb 100644
--- a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/RoutesTab.java
+++ b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/RoutesTab.java
@@ -496,7 +496,7 @@ class RoutesTab extends AbstractTab {
if (info.name != null) {
title = Line.from(
Span.raw(" Topology ["),
- Span.styled(info.name, Style.EMPTY.fg(Color.YELLOW).bold()),
+ Span.styled(info.name, Theme.label().bold()),
Span.raw("] "));
} else {
title = Line.from(Span.raw(" Topology "));
@@ -836,7 +836,7 @@ class RoutesTab extends AbstractTab {
List<Line> lines = new ArrayList<>();
if (route != null) {
lines.add(Line.from(
- Span.styled(" Route: ", Style.EMPTY.fg(Color.YELLOW).bold()),
+ Span.styled(" Route: ", Theme.label().bold()),
Span.styled(route.routeId, Style.EMPTY.fg(Color.WHITE).bold())));
lines.add(Line.from(
Span.styled(" From: ", Style.EMPTY.dim()),
@@ -983,7 +983,7 @@ class RoutesTab extends AbstractTab {
String linkedRoute = diagram.findLinkedRouteId(drillDownRouteId);
if (linkedRoute != null && diagram.getRouteLayout(linkedRoute) != null) {
lines.add(Line.from(
- Span.styled(" ↵ ", Style.EMPTY.fg(Color.YELLOW).bold()),
+ Span.styled(" ↵ ", Theme.label().bold()),
Span.styled(linkedRoute, Style.EMPTY.fg(Color.WHITE))));
} else if (ln.treeNode != null && ln.treeNode.info.remote) {
String arrow = "from".equals(ln.type) ? " external → " : " → external";
@@ -1060,7 +1060,7 @@ class RoutesTab extends AbstractTab {
}
private Line buildBreadcrumbTitle() {
- Style nameStyle = Style.EMPTY.fg(Color.YELLOW).bold();
+ Style nameStyle = Theme.label().bold();
List<Span> spans = new ArrayList<>();
spans.add(Span.raw(" Route ["));
if (routeNavigationStack.isEmpty()) {
diff --git a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/SearchHighlighter.java b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/SearchHighlighter.java
index a322e4d7b34a..bedadda2ee50 100644
--- a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/SearchHighlighter.java
+++ b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/SearchHighlighter.java
@@ -39,8 +39,6 @@ import static org.apache.camel.dsl.jbang.core.commands.tui.TuiHelper.hintLast;
*/
class SearchHighlighter {
- static final Style HIGHLIGHT_STYLE = Style.EMPTY.fg(Color.BLACK).bg(Color.YELLOW);
- static final Style FIND_MATCH_STYLE = Style.EMPTY.fg(Color.BLACK).bg(Color.YELLOW);
static final Style FIND_CURRENT_STYLE = Style.EMPTY.fg(Color.BLACK).bg(Color.LIGHT_GREEN);
private boolean findInputActive;
@@ -202,7 +200,7 @@ class SearchHighlighter {
Matcher m = highlightPattern.matcher(fullText);
while (m.find()) {
ranges.add(new int[] { m.start(), m.end() });
- rangeStyles.add(HIGHLIGHT_STYLE);
+ rangeStyles.add(Theme.searchMatch());
}
}
if (findPattern != null) {
@@ -210,7 +208,7 @@ class SearchHighlighter {
Matcher m = findPattern.matcher(fullText);
while (m.find()) {
ranges.add(new int[] { m.start(), m.end() });
- rangeStyles.add(isCurrentLine ? FIND_CURRENT_STYLE : FIND_MATCH_STYLE);
+ rangeStyles.add(isCurrentLine ? FIND_CURRENT_STYLE : Theme.searchMatch());
}
}
if (ranges.isEmpty()) {
diff --git a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/SendMessagePopup.java b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/SendMessagePopup.java
index 8c2476408089..3c6f8023ee72 100644
--- a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/SendMessagePopup.java
+++ b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/SendMessagePopup.java
@@ -696,7 +696,7 @@ class SendMessagePopup {
Block block = Block.builder()
.borderType(BorderType.ROUNDED).borders(Borders.ALL)
- .title(Title.from(Line.from(Span.styled(title, Style.EMPTY.fg(Color.YELLOW).bold()))))
+ .title(Title.from(Line.from(Span.styled(title, Theme.label().bold()))))
.build();
frame.renderWidget(block, area);
Rect inner = block.inner(area);
@@ -821,7 +821,7 @@ class SendMessagePopup {
titleStr = " Response ";
} else if (sending) {
titleStr = " Sending... ";
- titleStyle = Style.EMPTY.fg(Color.YELLOW).bold();
+ titleStyle = Theme.warning();
} else if (responseError) {
titleStr = " Response — Error ";
if (responseElapsed > 0) {
@@ -869,7 +869,7 @@ class SendMessagePopup {
&& !line.startsWith("[") && !line.startsWith("\"")) {
int colon = line.indexOf(": ");
lines.add(Line.from(
- Span.styled(line.substring(0, colon + 1), Style.EMPTY.fg(Color.YELLOW)),
+ Span.styled(line.substring(0, colon + 1), Theme.label()),
Span.raw(line.substring(colon + 1))));
} else {
lines.add(Line.from(Span.raw(line)));
diff --git a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/SourceViewer.java b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/SourceViewer.java
index c2d85af40a2b..8a021994117e 100644
--- a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/SourceViewer.java
+++ b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/SourceViewer.java
@@ -779,9 +779,9 @@ class SourceViewer {
List<Span> spans = new ArrayList<>();
Style selBg = Style.EMPTY.bg(Color.rgb(30, 45, 70));
if (isSelected) {
- spans.add(Span.styled(">> ", Style.EMPTY.fg(Color.YELLOW).bold()));
+ spans.add(Span.styled(">> ", Theme.label().bold()));
if (!prefix.isEmpty()) {
- spans.add(Span.styled(prefix, Style.EMPTY.fg(Color.YELLOW).bold().patch(selBg)));
+ spans.add(Span.styled(prefix, Theme.label().bold().patch(selBg)));
}
for (Span s : highlighted.spans()) {
spans.add(Span.styled(s.content(), s.style().patch(selBg)));
diff --git a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/SpansTab.java b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/SpansTab.java
index f97069bd5dbf..f8bd50c7c96c 100644
--- a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/SpansTab.java
+++ b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/SpansTab.java
@@ -399,10 +399,10 @@ class SpansTab extends AbstractTab {
Cell.from(Span.styled(sortLabel("FROM", "from"), sortStyle("from"))),
Cell.from(Span.styled(sortLabel("SPANS", "spans"), sortStyle("spans"))),
Cell.from(Span.styled(sortLabel("ROUTES", "routes"), sortStyle("routes"))),
- Cell.from(Span.styled("REMOTE", Style.EMPTY.fg(Color.YELLOW).bold())),
+ Cell.from(Span.styled("REMOTE", Theme.label().bold())),
Cell.from(Span.styled(sortLabel("STATUS", "status"), sortStyle("status"))),
Cell.from(Span.styled(sortLabel("DURATION", "duration"), sortStyle("duration"))),
- Cell.from(Span.styled("DEPTH", Style.EMPTY.fg(Color.YELLOW).bold()))))
+ Cell.from(Span.styled("DEPTH", Theme.label().bold()))))
.widths(
Constraint.length(10),
Constraint.length(20),
@@ -564,7 +564,7 @@ class SpansTab extends AbstractTab {
String errorTag = error ? " ERR" : "";
return Line.from(
- Span.styled(indicator, Style.EMPTY.fg(Color.YELLOW).bold()),
+ Span.styled(indicator, Theme.label().bold()),
Span.styled(label, labelStyle),
Span.raw(gap),
Span.styled(bar, bandStyle),
@@ -605,11 +605,11 @@ class SpansTab extends AbstractTab {
List<Span> ctx = new ArrayList<>();
if (span.routeId() != null) {
ctx.add(Span.styled(" Route: ", Style.EMPTY.dim()));
- ctx.add(Span.styled(span.routeId(), Style.EMPTY.fg(Color.YELLOW)));
+ ctx.add(Span.styled(span.routeId(), Theme.label()));
}
if (span.processorId() != null) {
ctx.add(Span.styled(" Processor: ", Style.EMPTY.dim()));
- ctx.add(Span.styled(span.processorId(), Style.EMPTY.fg(Color.YELLOW)));
+ ctx.add(Span.styled(span.processorId(), Theme.label()));
}
if (!span.isCamelSpan()) {
ctx.add(Span.styled(" Source: ", Style.EMPTY.dim()));
@@ -650,7 +650,7 @@ class SpansTab extends AbstractTab {
hint(spans, TuiIcons.HINT_SCROLL, "navigate");
hintLast(spans, "PgUp/Dn", "page");
} else if (filterInputActive) {
- spans.add(Span.styled(" /", Style.EMPTY.fg(Color.YELLOW).bold()));
+ spans.add(Span.styled(" /", Theme.label().bold()));
spans.add(Span.raw(filterInputState.text() + "█ "));
hint(spans, "Enter", "filter");
hintLast(spans, "Esc", "cancel");
@@ -659,7 +659,7 @@ class SpansTab extends AbstractTab {
hint(spans, "F5", "refresh");
hint(spans, "Enter", "waterfall");
if (filterTerm != null) {
- spans.add(Span.styled(" /", Style.EMPTY.fg(Color.YELLOW).bold()));
+ spans.add(Span.styled(" /", Theme.label().bold()));
spans.add(Span.raw("\"" + filterTerm + "\" "));
} else {
hint(spans, "/", "filter");
@@ -955,7 +955,7 @@ class SpansTab extends AbstractTab {
}
private Style sortStyle(String column) {
- return Style.EMPTY.fg(Color.YELLOW).bold();
+ return Theme.label().bold();
}
private static int computeMaxDepth(List<SpanEntry> traceSpans) {
diff --git a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/SqlQueryTab.java b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/SqlQueryTab.java
index 99d4b8cf920d..416064637c7a 100644
--- a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/SqlQueryTab.java
+++ b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/SqlQueryTab.java
@@ -488,7 +488,7 @@ class SqlQueryTab extends AbstractTab {
int[] widths = computeColumnWidths(area.width() - 2);
Row header = Row.from(buildHeaderCells());
- header.style(Style.EMPTY.fg(Color.YELLOW));
+ header.style(Theme.label());
List<Row> dataRows = new ArrayList<>();
for (JsonObject row : resultRows) {
@@ -544,7 +544,7 @@ class SqlQueryTab extends AbstractTab {
if (columnIsPk != null && columnIsPk[i]) {
label = label + " " + TuiIcons.KEY;
}
- cells[i] = Cell.from(Span.styled(label, Style.EMPTY.fg(Color.YELLOW)));
+ cells[i] = Cell.from(Span.styled(label, Theme.label().bold()));
}
return cells;
}
@@ -747,7 +747,7 @@ class SqlQueryTab extends AbstractTab {
Block block = Block.builder()
.borderType(BorderType.ROUNDED)
- .title(Title.from(Line.from(Span.styled(title, Style.EMPTY.fg(Color.YELLOW).bold()))))
+ .title(Title.from(Line.from(Span.styled(title, Theme.label().bold()))))
.build();
Rect inner = block.inner(popup);
frame.renderWidget(block, popup);
@@ -807,9 +807,9 @@ class SqlQueryTab extends AbstractTab {
if (footerY < popup.bottom() - 1) {
Rect footerArea = new Rect(inner.left(), footerY, inner.width(), 1);
frame.renderWidget(Paragraph.from(Line.from(
- Span.styled(" F5", Style.EMPTY.fg(Color.YELLOW)),
+ Span.styled(" F5", Theme.label().bold()),
Span.styled("=Save ", Style.EMPTY.fg(Color.DARK_GRAY)),
- Span.styled("Esc", Style.EMPTY.fg(Color.YELLOW)),
+ Span.styled("Esc", Theme.label().bold()),
Span.styled("=Cancel ", Style.EMPTY.fg(Color.DARK_GRAY)),
Span.styled("*", Style.EMPTY.fg(Color.DARK_GRAY)),
Span.styled("=Primary Key", Style.EMPTY.fg(Color.DARK_GRAY)))), footerArea);
diff --git a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/SqlTraceTab.java b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/SqlTraceTab.java
index 812c82352a92..4724385ae31b 100644
--- a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/SqlTraceTab.java
+++ b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/SqlTraceTab.java
@@ -146,7 +146,7 @@ class SqlTraceTab extends AbstractTableTab {
private void renderKpiStrip(Frame frame, Rect area, IntegrationInfo info) {
Style labelStyle = Style.EMPTY.dim();
Style valueStyle = Style.EMPTY.fg(Color.CYAN).bold();
- Style warnStyle = Style.EMPTY.fg(Color.YELLOW).bold();
+ Style warnStyle = Theme.warning().bold();
Style errorStyle = Style.EMPTY.fg(Color.LIGHT_RED).bold();
List<Span> spans = new ArrayList<>();
@@ -233,7 +233,7 @@ class SqlTraceTab extends AbstractTableTab {
private void renderTable(Frame frame, Rect area, List<SqlTraceInfo> sorted) {
List<Row> rows = new ArrayList<>();
for (SqlTraceInfo si : sorted) {
- Style durStyle = si.duration >= 100 ? Style.EMPTY.fg(Color.YELLOW) : Style.EMPTY;
+ Style durStyle = si.duration >= 100 ? Theme.warning() : Style.EMPTY;
Style statusStyle = si.failed ? Style.EMPTY.fg(Color.LIGHT_RED) : Style.EMPTY.fg(Color.GREEN);
String status = si.failed ? "FAIL" : "OK";
@@ -339,7 +339,7 @@ class SqlTraceTab extends AbstractTableTab {
time = LocalDateTime.ofInstant(Instant.ofEpochMilli(si.timestamp), ZoneId.systemDefault())
.format(TIME_FMT);
}
- Style durStyle = si.duration >= 100 ? Style.EMPTY.fg(Color.YELLOW) : Style.EMPTY;
+ Style durStyle = si.duration >= 100 ? Theme.warning() : Style.EMPTY;
Style statusStyle = si.failed ? Style.EMPTY.fg(Color.LIGHT_RED) : Style.EMPTY.fg(Color.GREEN);
lines.add(Line.from(
Span.styled(" Time: ", labelStyle),
@@ -378,7 +378,7 @@ class SqlTraceTab extends AbstractTableTab {
return switch (category) {
case "SELECT" -> Style.EMPTY.fg(Color.CYAN);
case "INSERT" -> Style.EMPTY.fg(Color.GREEN);
- case "UPDATE" -> Style.EMPTY.fg(Color.YELLOW);
+ case "UPDATE" -> Theme.label();
case "DELETE" -> Style.EMPTY.fg(Color.LIGHT_RED);
default -> Style.EMPTY;
};
diff --git a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/StartupTab.java b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/StartupTab.java
index 108e49173f57..0e685c2d567c 100644
--- a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/StartupTab.java
+++ b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/StartupTab.java
@@ -52,7 +52,6 @@ class StartupTab extends AbstractTab {
private static final int MOUSE_SCROLL_LINES = 3;
private static final Style LABEL = Style.EMPTY.dim();
private static final Style VALUE = Style.EMPTY.fg(Color.WHITE).bold();
- private static final Style HEADER = Style.EMPTY.fg(Color.YELLOW).bold();
private final ScrollbarState scrollbarState = new ScrollbarState();
private final AtomicBoolean loading = new AtomicBoolean(false);
diff --git a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/Theme.java b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/Theme.java
index 748a4ebb7707..3a2057be8943 100644
--- a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/Theme.java
+++ b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/Theme.java
@@ -44,7 +44,7 @@ import org.slf4j.LoggerFactory;
* plain white/black foregrounds. Fallbacks mirror {@code dark.tcss}. If a stylesheet is missing or malformed, the
* facade falls back to the built-in palette below and logs once, so a cosmetic failure never crashes the TUI.
*/
-final class Theme {
+public final class Theme {
/** Camel brand orange. */
static final Color ACCENT = Color.rgb(0xF6, 0x91, 0x23);
@@ -73,6 +73,21 @@ final class Theme {
private static final Color FALLBACK_BASE_BG = Color.rgb(0x1E, 0x1E, 0x1E);
private static final Color FALLBACK_BASE_FG = Color.rgb(0xD4, 0xD4, 0xD4);
+ // Content token fallbacks (dark-theme defaults).
+ private static final Style FALLBACK_LABEL = Style.EMPTY.fg(Color.rgb(0xDC, 0xDC, 0xAA));
+ private static final Style FALLBACK_CHANGE = Style.EMPTY.fg(Color.rgb(0xDC, 0xDC, 0xAA));
+ private static final Style FALLBACK_SEARCH_MATCH = Style.EMPTY.fg(Color.BLACK).bg(Color.rgb(0xDC, 0xDC, 0xAA));
+
+ // Diagram token fallbacks (dark-theme defaults).
+ private static final Color FALLBACK_DIAGRAM_BORDER = Color.rgb(0x80, 0x80, 0x80);
+ private static final Color FALLBACK_DIAGRAM_ID = FALLBACK_BASE_FG;
+ private static final Color FALLBACK_DIAGRAM_FROM = Color.rgb(0x4E, 0xC9, 0xB0);
+ private static final Color FALLBACK_DIAGRAM_TO = Color.rgb(0x56, 0xB6, 0xC2);
+ private static final Color FALLBACK_DIAGRAM_CHOICE = Color.rgb(0xDC, 0xDC, 0xAA);
+ private static final Color FALLBACK_DIAGRAM_ACTION = Color.rgb(0xC5, 0x86, 0xC0);
+ private static final Color FALLBACK_DIAGRAM_EIP = Color.rgb(0x89, 0x57, 0xE5);
+ private static final Color FALLBACK_DIAGRAM_DEFAULT = Color.rgb(0x80, 0x80, 0x80);
+
private static final Map<String, Style> CACHE = new HashMap<>();
private static boolean initialized;
@@ -88,7 +103,7 @@ final class Theme {
private Theme() {
}
- static synchronized Color accent() {
+ public static synchronized Color accent() {
StyleEngine e = engine();
if (e == null) {
return ACCENT;
@@ -105,7 +120,7 @@ final class Theme {
* Subtle alternating-row background for zebra striping. Theme-aware (dark gray on dark, light gray on light) so
* stripes stay readable on both terminals. Applied at the row level so it never overrides the selection highlight.
*/
- static synchronized Color zebra() {
+ public static synchronized Color zebra() {
StyleEngine e = engine();
if (e == null) {
return FALLBACK_ZEBRA;
@@ -121,7 +136,7 @@ final class Theme {
/**
* Base background color for the main content area. Theme-aware (dark on dark mode, white on light mode).
*/
- static Color baseBg() {
+ public static Color baseBg() {
StyleEngine e = engine();
if (e == null) {
return FALLBACK_BASE_BG;
@@ -137,7 +152,7 @@ final class Theme {
/**
* Base foreground color for normal text. Theme-aware (light gray on dark mode, dark gray on light mode).
*/
- static Color baseFg() {
+ public static Color baseFg() {
StyleEngine e = engine();
if (e == null) {
return FALLBACK_BASE_FG;
@@ -151,90 +166,145 @@ final class Theme {
}
/** White-on-orange: active tab highlight. */
- static Style accentBg() {
+ public static Style accentBg() {
return style("accent-bg", FALLBACK_ACCENT_BG);
}
/** Black-on-orange chip: key hints in footers and prompts. */
- static Style hintKey() {
+ public static Style hintKey() {
return style("hint-key", FALLBACK_HINT_KEY);
}
/** Dim border for unfocused panels. */
- static Style border() {
+ public static Style border() {
return style("border", FALLBACK_BORDER);
}
/** Orange border for the focused panel. */
- static Style borderFocused() {
+ public static Style borderFocused() {
return style("border-focused", FALLBACK_BORDER_FOCUSED);
}
/** Panel and border titles. */
- static Style title() {
+ public static Style title() {
return style("title", FALLBACK_TITLE);
}
- static Style success() {
+ public static Style success() {
return style("success", FALLBACK_SUCCESS);
}
- static Style warning() {
+ public static Style warning() {
return style("warning", FALLBACK_WARNING);
}
- static Style error() {
+ public static Style error() {
return style("error", FALLBACK_ERROR);
}
- static Style muted() {
+ public static Style muted() {
return style("muted", FALLBACK_MUTED);
}
/** Row/selection highlight (matches the existing list highlight). */
- static Style selectionBg() {
+ public static Style selectionBg() {
return style("selection", FALLBACK_SELECTION);
}
/** Informational accent (header integration count, integration name text, popup prompts). */
- static Style info() {
+ public static Style info() {
return style("info", FALLBACK_INFO);
}
/** Secondary accent (header infra / selected). */
- static Style notice() {
+ public static Style notice() {
return style("notice", FALLBACK_NOTICE);
}
/** MCP indicator: connected with recent activity. */
- static Style mcpActive() {
+ public static Style mcpActive() {
return style("mcp-active", FALLBACK_MCP_ACTIVE);
}
/** MCP indicator: connected but idle. */
- static Style mcpIdle() {
+ public static Style mcpIdle() {
return style("mcp-idle", FALLBACK_MCP_IDLE);
}
/** MCP indicator: not connected. */
- static Style mcpDown() {
+ public static Style mcpDown() {
return style("mcp-down", FALLBACK_MCP_DOWN);
}
+ /** Secondary accent for field labels, section headers, key hints, and popup titles. */
+ public static Style label() {
+ return style("label", FALLBACK_LABEL);
+ }
+
+ /** Changed-value indicator in trace diffs. */
+ public static Style change() {
+ return style("change", FALLBACK_CHANGE);
+ }
+
+ /** Search/find match highlight (foreground + background). */
+ public static Style searchMatch() {
+ return style("search-match", FALLBACK_SEARCH_MATCH);
+ }
+
+ /** Diagram box-drawing border color. */
+ public static synchronized Color diagramBorder() {
+ return color("diagram-border", FALLBACK_DIAGRAM_BORDER);
+ }
+
+ /** Route ID text color in diagrams. */
+ public static synchronized Color diagramId() {
+ return color("diagram-id", FALLBACK_DIAGRAM_ID);
+ }
+
+ /** Diagram color for "from" EIP nodes. */
+ public static synchronized Color diagramFrom() {
+ return color("diagram-from", FALLBACK_DIAGRAM_FROM);
+ }
+
+ /** Diagram color for "to", "enrich", marshal, and transform EIP nodes. */
+ public static synchronized Color diagramTo() {
+ return color("diagram-to", FALLBACK_DIAGRAM_TO);
+ }
+
+ /** Diagram color for "choice"/"when"/"otherwise" EIP nodes. */
+ public static synchronized Color diagramChoice() {
+ return color("diagram-choice", FALLBACK_DIAGRAM_CHOICE);
+ }
+
+ /** Diagram color for "bean"/"process"/"log"/"script" EIP nodes. */
+ public static synchronized Color diagramAction() {
+ return color("diagram-action", FALLBACK_DIAGRAM_ACTION);
+ }
+
+ /** Diagram color for routing EIPs (split, aggregate, multicast, etc.). */
+ public static synchronized Color diagramEip() {
+ return color("diagram-eip", FALLBACK_DIAGRAM_EIP);
+ }
+
+ /** Diagram fallback color for unknown EIP types. */
+ public static synchronized Color diagramDefault() {
+ return color("diagram-default", FALLBACK_DIAGRAM_DEFAULT);
+ }
+
/** The active theme mode: {@code "dark"} or {@code "light"}. */
- static String mode() {
+ public static String mode() {
engine();
return mode.id();
}
/** True if the active mode is dark. */
- static boolean isDark() {
+ public static boolean isDark() {
engine();
return mode == ThemeMode.DARK;
}
/** Flip the active theme mode, persist it (outside test mode), and activate it, returning the new mode. */
- static synchronized String toggle() {
+ public static synchronized String toggle() {
ThemeMode next = mode.toggle();
if (!testMode) {
persist(next);
@@ -250,7 +320,7 @@ final class Theme {
* loaded, so outside test mode a later {@link #engine()} re-initialization can still overwrite the mode with
* whatever is on disk.
*/
- static synchronized void setMode(String newMode) {
+ public static synchronized void setMode(String newMode) {
activate(ThemeMode.parseOrDefault(newMode), false);
}
@@ -261,19 +331,19 @@ final class Theme {
* @throws IllegalArgumentException if {@code newMode} is not a known theme mode; callers should normally validate
* with {@link #isValidMode(String)} first to report a friendlier CLI error.
*/
- static synchronized void applyStartupMode(String newMode) {
+ public static synchronized void applyStartupMode(String newMode) {
ThemeMode parsed = ThemeMode.parse(newMode)
.orElseThrow(() -> new IllegalArgumentException("Unknown Camel TUI theme mode: " + newMode));
activate(parsed, true);
}
/** Whether {@code value} parses to a known theme mode. */
- static boolean isValidMode(String value) {
+ public static boolean isValidMode(String value) {
return ThemeMode.parse(value).isPresent();
}
/** Test hook: enable in-memory-only mode so tests never touch user config files. */
- static synchronized void resetForTesting() {
+ public static synchronized void resetForTesting() {
resetForTesting(true);
}
@@ -281,7 +351,7 @@ final class Theme {
* Test hook like {@link #resetForTesting()}, but lets the caller keep {@code testMode} disabled so a test can
* exercise the real persistence path (disk read/write) against an isolated home directory.
*/
- static synchronized void resetForTesting(boolean testModeValue) {
+ public static synchronized void resetForTesting(boolean testModeValue) {
testMode = testModeValue;
stylesheetFallbackLogged = false;
tokenFallbackLogged = false;
@@ -305,6 +375,19 @@ final class Theme {
engine();
}
+ private static synchronized Color color(String id, Color fallback) {
+ StyleEngine e = engine();
+ if (e == null) {
+ return fallback;
+ }
+ try {
+ return e.resolve(new Token(id)).foreground().orElse(fallback);
+ } catch (RuntimeException ex) {
+ logTokenFallbackOnce(ex);
+ return fallback;
+ }
+ }
+
private static synchronized Style style(String id, Style fallback) {
StyleEngine e = engine();
if (e == null) {
diff --git a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/ThreadsTab.java b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/ThreadsTab.java
index 8d97388763fa..b6a20ff40245 100644
--- a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/ThreadsTab.java
+++ b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/ThreadsTab.java
@@ -251,7 +251,7 @@ class ThreadsTab extends AbstractTableTab {
String frame2 = thread.stackTrace.get(i);
Style style = Style.EMPTY;
if (frame2 != null && frame2.contains("org.apache.camel")) {
- style = Style.EMPTY.fg(Color.YELLOW);
+ style = Theme.label();
}
lines.add(Line.from(Span.styled(" " + (frame2 != null ? frame2 : ""), style)));
}
@@ -318,7 +318,7 @@ class ThreadsTab extends AbstractTableTab {
return switch (state) {
case "RUNNABLE" -> Style.EMPTY.fg(Color.GREEN);
case "BLOCKED" -> Style.EMPTY.fg(Color.LIGHT_RED);
- case "WAITING" -> Style.EMPTY.fg(Color.YELLOW);
+ case "WAITING" -> Theme.warning();
case "TIMED_WAITING" -> Style.EMPTY.fg(Color.CYAN);
default -> Style.EMPTY;
};
diff --git a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/TuiHelper.java b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/TuiHelper.java
index b8cd041090d9..5c4fe9f8c885 100644
--- a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/TuiHelper.java
+++ b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/TuiHelper.java
@@ -427,6 +427,10 @@ final class TuiHelper {
double ratio = (Math.log1p(duration) - Math.log1p(minDuration))
/ (Math.log1p(maxDuration) - Math.log1p(minDuration));
int bandIndex = Math.max(0, Math.min((int) (ratio * 5), 4));
+ // band 2 uses the theme warning color instead of the static array entry
+ if (bandIndex == 2) {
+ return Theme.warning();
+ }
return DURATION_BAND_STYLES[bandIndex];
}
@@ -567,7 +571,7 @@ final class TuiHelper {
if (ms >= 1000) {
return Style.EMPTY.fg(Color.LIGHT_RED).bold();
} else if (ms >= 100) {
- return Style.EMPTY.fg(Color.YELLOW);
+ return Theme.warning();
}
return Style.EMPTY;
}
diff --git a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/diagram/DiagramColors.java b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/diagram/DiagramColors.java
index 8b01d00902f8..93252c6f0fbf 100644
--- a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/diagram/DiagramColors.java
+++ b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/diagram/DiagramColors.java
@@ -18,23 +18,10 @@ package org.apache.camel.dsl.jbang.core.commands.tui.diagram;
import dev.tamboui.style.Color;
import dev.tamboui.style.Style;
+import org.apache.camel.dsl.jbang.core.commands.tui.Theme;
public final class DiagramColors {
- static final Color OK_COLOR = Color.GREEN;
- static final Color FAIL_COLOR = Color.LIGHT_RED;
- static final Color EXTERNAL_COLOR = Color.CYAN;
-
- static final Style BORDER_STYLE = Style.EMPTY.fg(Color.WHITE);
- static final Style DASHED_BORDER_STYLE = Style.EMPTY.fg(Color.CYAN);
- static final Style SELECTION_STYLE = Style.EMPTY.bg(Color.DARK_GRAY);
- static final Style ROUTE_ID_STYLE = Style.EMPTY.fg(Color.WHITE).bold();
- static final Style FROM_LABEL_STYLE = Style.EMPTY.fg(Color.GRAY);
- static final Style METRICS_OK_STYLE = Style.EMPTY.fg(Color.GREEN);
- static final Style METRICS_FAIL_STYLE = Style.EMPTY.fg(Color.LIGHT_RED).bold();
- static final Color HIGHLIGHT_OK_COLOR = Color.GREEN;
- static final Color HIGHLIGHT_FAIL_COLOR = Color.LIGHT_RED;
-
// Unicode box-drawing characters
static final char H = '─';
static final char V = '│';
@@ -52,25 +39,73 @@ public final class DiagramColors {
private DiagramColors() {
}
+ static Style borderStyle() {
+ return Style.EMPTY.fg(Theme.diagramBorder());
+ }
+
+ static Style dashedBorderStyle() {
+ return Style.EMPTY.fg(Theme.diagramTo());
+ }
+
+ static Style selectionStyle() {
+ return Theme.selectionBg();
+ }
+
+ static Style routeIdStyle() {
+ return Style.EMPTY.fg(Theme.diagramId()).bold();
+ }
+
+ static Style fromLabelStyle() {
+ return Theme.muted();
+ }
+
+ static Style metricsOkStyle() {
+ return Theme.success();
+ }
+
+ static Style metricsFailStyle() {
+ return Theme.error().bold();
+ }
+
+ static Color okColor() {
+ return Theme.diagramFrom();
+ }
+
+ static Color failColor() {
+ return Theme.error().fg().orElse(Color.LIGHT_RED);
+ }
+
+ static Color externalColor() {
+ return Theme.diagramTo();
+ }
+
+ static Color highlightOkColor() {
+ return Theme.diagramFrom();
+ }
+
+ static Color highlightFailColor() {
+ return Theme.error().fg().orElse(Color.LIGHT_RED);
+ }
+
public static Color getEipColor(String type) {
if (type == null) {
- return Color.GRAY;
+ return Theme.diagramDefault();
}
return switch (type) {
- case "from" -> Color.GREEN;
- case "to", "toD", "wireTap", "enrich", "pollEnrich" -> Color.CYAN;
- case "choice", "when", "otherwise" -> Color.YELLOW;
+ case "from" -> Theme.diagramFrom();
+ case "to", "toD", "wireTap", "enrich", "pollEnrich" -> Theme.diagramTo();
+ case "choice", "when", "otherwise" -> Theme.diagramChoice();
case "marshal", "unmarshal", "transform", "setBody", "setHeader", "setProperty",
"convertBodyTo", "removeHeader", "removeHeaders", "removeProperty", "removeProperties" ->
- Color.CYAN;
- case "bean", "process", "log", "script", "delay" -> Color.MAGENTA;
+ Theme.diagramTo();
+ case "bean", "process", "log", "script", "delay" -> Theme.diagramAction();
case "filter", "split", "aggregate", "multicast", "recipientList",
"routingSlip", "dynamicRouter", "loadBalance",
"circuitBreaker", "saga", "doTry", "doCatch", "doFinally",
"onException", "onCompletion", "intercept",
"loop", "resequence", "throttle", "kamelet", "pipeline", "threads" ->
- Color.rgb(0x89, 0x57, 0xE5);
- default -> Color.GRAY;
+ Theme.diagramEip();
+ default -> Theme.diagramDefault();
};
}
}
diff --git a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/diagram/RouteDiagramWidget.java b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/diagram/RouteDiagramWidget.java
index 9264f375f337..de626ac1e5ea 100644
--- a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/diagram/RouteDiagramWidget.java
+++ b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/diagram/RouteDiagramWidget.java
@@ -33,6 +33,7 @@ import org.apache.camel.diagram.RouteDiagramLayoutEngine.LayoutNode;
import org.apache.camel.diagram.RouteDiagramLayoutEngine.LayoutRoute;
import org.apache.camel.diagram.RouteDiagramLayoutEngine.StatInfo;
import org.apache.camel.diagram.RouteDiagramLayoutEngine.TreeNode;
+import org.apache.camel.dsl.jbang.core.commands.tui.Theme;
import static org.apache.camel.diagram.RouteDiagramLayoutEngine.BRANCH_CHILD_TYPES;
import static org.apache.camel.diagram.RouteDiagramLayoutEngine.PADDING;
@@ -187,13 +188,13 @@ public class RouteDiagramWidget implements Widget {
Color eipColor;
if (highlighted) {
- eipColor = highlightFailed ? HIGHLIGHT_FAIL_COLOR : HIGHLIGHT_OK_COLOR;
+ eipColor = highlightFailed ? highlightFailColor() : highlightOkColor();
} else {
eipColor = getEipColor(node.type);
}
Style borderStyle = Style.EMPTY.fg(eipColor);
if (selected) {
- borderStyle = borderStyle.patch(SELECTION_STYLE);
+ borderStyle = borderStyle.patch(selectionStyle());
}
char hChar = external ? DASH_H : H;
@@ -220,7 +221,7 @@ public class RouteDiagramWidget implements Widget {
setChar(buffer, area, r, col, vChar, borderStyle);
setChar(buffer, area, r, col + boxWidth - 1, vChar, borderStyle);
- Style bgStyle = selected ? SELECTION_STYLE : Style.EMPTY;
+ Style bgStyle = selected ? selectionStyle() : Style.EMPTY;
for (int c = col + 1; c < col + boxWidth - 1; c++) {
setChar(buffer, area, r, c, ' ', bgStyle);
}
@@ -235,14 +236,14 @@ public class RouteDiagramWidget implements Widget {
if (i == 0) {
writeText(buffer, area, r, textCol, text, style(Style.EMPTY.fg(eipColor).bold(), selected));
} else {
- writeText(buffer, area, r, textCol, text, style(FROM_LABEL_STYLE, selected));
+ writeText(buffer, area, r, textCol, text, style(fromLabelStyle(), selected));
}
}
// Link indicator for nodes that connect to other routes
String linkedRouteId = findLinkedRouteId(node);
if (linkedRouteId != null) {
- Style linkStyle = Style.EMPTY.fg(Color.YELLOW).bold();
+ Style linkStyle = Theme.label().bold();
writeText(buffer, area, bottom, col + boxWidth, " ↵ " + linkedRouteId, linkStyle);
}
@@ -296,9 +297,9 @@ public class RouteDiagramWidget implements Widget {
char hChar = dashed ? DASH_H : H;
Style edgeStyle;
if (highlighted) {
- edgeStyle = Style.EMPTY.fg(highlightFailed ? HIGHLIGHT_FAIL_COLOR : HIGHLIGHT_OK_COLOR);
+ edgeStyle = Style.EMPTY.fg(highlightFailed ? highlightFailColor() : highlightOkColor());
} else if (external) {
- edgeStyle = Style.EMPTY.fg(EXTERNAL_COLOR);
+ edgeStyle = Style.EMPTY.fg(externalColor());
} else if (dashed) {
edgeStyle = Style.EMPTY.fg(Color.DARK_GRAY);
} else {
@@ -342,12 +343,12 @@ public class RouteDiagramWidget implements Widget {
long ok = total - failed;
if (ok > 0) {
String okStr = String.valueOf(ok);
- writeText(buffer, area, toTop - 1, toCx + 2, okStr, METRICS_OK_STYLE);
+ writeText(buffer, area, toTop - 1, toCx + 2, okStr, metricsOkStyle());
}
if (failed > 0) {
String failStr = String.valueOf(failed);
int col = toCx - 1 - failStr.length();
- writeText(buffer, area, toTop - 1, col, failStr, METRICS_FAIL_STYLE);
+ writeText(buffer, area, toTop - 1, col, failStr, metricsFailStyle());
}
}
@@ -488,7 +489,7 @@ public class RouteDiagramWidget implements Widget {
}
private Style style(Style base, boolean selected) {
- return selected ? base.patch(SELECTION_STYLE) : base;
+ return selected ? base.patch(selectionStyle()) : base;
}
private int toCol(int pixelX) {
diff --git a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/diagram/TopologyDiagramWidget.java b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/diagram/TopologyDiagramWidget.java
index c53d2ec04205..d8cd3a25656f 100644
--- a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/diagram/TopologyDiagramWidget.java
+++ b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/diagram/TopologyDiagramWidget.java
@@ -29,6 +29,7 @@ import dev.tamboui.widget.Widget;
import org.apache.camel.diagram.TopologyLayoutEngine.TopologyLayoutEdge;
import org.apache.camel.diagram.TopologyLayoutEngine.TopologyLayoutNode;
import org.apache.camel.diagram.TopologyLayoutEngine.TopologyLayoutResult;
+import org.apache.camel.dsl.jbang.core.commands.tui.Theme;
import static org.apache.camel.dsl.jbang.core.commands.tui.diagram.DiagramColors.*;
@@ -171,13 +172,13 @@ public class TopologyDiagramWidget implements Widget {
char vChar = ext ? DASH_V : V;
Style borderStyle;
if (highlighted) {
- Color hlColor = highlightFailed ? HIGHLIGHT_FAIL_COLOR : HIGHLIGHT_OK_COLOR;
+ Color hlColor = highlightFailed ? highlightFailColor() : highlightOkColor();
borderStyle = Style.EMPTY.fg(hlColor).bold();
} else {
- borderStyle = ext ? DASHED_BORDER_STYLE : BORDER_STYLE;
+ borderStyle = ext ? dashedBorderStyle() : borderStyle();
}
if (selected) {
- borderStyle = borderStyle.patch(SELECTION_STYLE);
+ borderStyle = borderStyle.patch(selectionStyle());
}
// Top border
@@ -203,7 +204,7 @@ public class TopologyDiagramWidget implements Widget {
setChar(buffer, area, r, col + boxWidth - 1, vChar, borderStyle);
// Clear interior
- Style bgStyle = selected ? SELECTION_STYLE : Style.EMPTY;
+ Style bgStyle = selected ? selectionStyle() : Style.EMPTY;
for (int c = col + 1; c < col + boxWidth - 1; c++) {
setChar(buffer, area, r, c, ' ', bgStyle);
}
@@ -216,16 +217,16 @@ public class TopologyDiagramWidget implements Widget {
// Choose style based on content type
if (ext && i == 0) {
- writeText(buffer, area, r, textCol, text, style(DASHED_BORDER_STYLE, selected));
+ writeText(buffer, area, r, textCol, text, style(dashedBorderStyle(), selected));
} else if (showMetrics && i == lines.size() - 1 && node.exchangesTotal > 0) {
drawMetricsLine(buffer, area, r, textCol, text, node, selected);
} else if (i == 0 && !ext) {
Style idStyle = highlighted
- ? Style.EMPTY.fg(highlightFailed ? HIGHLIGHT_FAIL_COLOR : HIGHLIGHT_OK_COLOR).bold()
- : ROUTE_ID_STYLE;
+ ? Style.EMPTY.fg(highlightFailed ? highlightFailColor() : highlightOkColor()).bold()
+ : routeIdStyle();
writeText(buffer, area, r, textCol, text, style(idStyle, selected));
} else {
- writeText(buffer, area, r, textCol, text, style(FROM_LABEL_STYLE, selected));
+ writeText(buffer, area, r, textCol, text, style(fromLabelStyle(), selected));
}
}
@@ -239,14 +240,14 @@ public class TopologyDiagramWidget implements Widget {
if (ok > 0 && node.exchangesFailed > 0) {
String okStr = String.valueOf(ok);
String failStr = String.valueOf(node.exchangesFailed);
- writeText(buffer, area, row, col, okStr, style(METRICS_OK_STYLE, selected));
+ writeText(buffer, area, row, col, okStr, style(metricsOkStyle(), selected));
int slashCol = col + okStr.length();
- writeText(buffer, area, row, slashCol, "/", style(Style.EMPTY.fg(Color.GRAY), selected));
- writeText(buffer, area, row, slashCol + 1, failStr, style(METRICS_FAIL_STYLE, selected));
+ writeText(buffer, area, row, slashCol, "/", style(Style.EMPTY.fg(Theme.diagramBorder()), selected));
+ writeText(buffer, area, row, slashCol + 1, failStr, style(metricsFailStyle(), selected));
} else if (ok > 0) {
- writeText(buffer, area, row, col, text, style(METRICS_OK_STYLE, selected));
+ writeText(buffer, area, row, col, text, style(metricsOkStyle(), selected));
} else if (node.exchangesFailed > 0) {
- writeText(buffer, area, row, col, text, style(METRICS_FAIL_STYLE, selected));
+ writeText(buffer, area, row, col, text, style(metricsFailStyle(), selected));
}
}
@@ -268,9 +269,9 @@ public class TopologyDiagramWidget implements Widget {
&& edge.to.routeId != null && highlightRouteIds.contains(edge.to.routeId);
Style edgeStyle;
if (edgeHighlighted) {
- edgeStyle = Style.EMPTY.fg(highlightFailed ? HIGHLIGHT_FAIL_COLOR : HIGHLIGHT_OK_COLOR);
+ edgeStyle = Style.EMPTY.fg(highlightFailed ? highlightFailColor() : highlightOkColor());
} else {
- edgeStyle = dashed ? DASHED_BORDER_STYLE : Style.EMPTY.fg(Color.GRAY);
+ edgeStyle = dashed ? dashedBorderStyle() : Style.EMPTY.fg(Theme.diagramBorder());
}
if (fromCx == toCx) {
@@ -306,7 +307,7 @@ public class TopologyDiagramWidget implements Widget {
int topRow = toRow(edge.from.y) + 1;
int botRow = topRow + 2;
- Style s = Style.EMPTY.fg(Color.GRAY);
+ Style s = Style.EMPTY.fg(Theme.diagramBorder());
for (int c = col; c < col + 3; c++) {
setChar(buffer, area, topRow, c, H, s);
setChar(buffer, area, botRow, c, H, s);
@@ -373,7 +374,7 @@ public class TopologyDiagramWidget implements Widget {
}
private Style style(Style base, boolean selected) {
- return selected ? base.patch(SELECTION_STYLE) : base;
+ return selected ? base.patch(selectionStyle()) : base;
}
private int toCol(int pixelX) {
diff --git a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/diagram/TopologyMinimapWidget.java b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/diagram/TopologyMinimapWidget.java
index 0ebeeb90afd5..68ba5af3f8bb 100644
--- a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/diagram/TopologyMinimapWidget.java
+++ b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/diagram/TopologyMinimapWidget.java
@@ -18,18 +18,14 @@ package org.apache.camel.dsl.jbang.core.commands.tui.diagram;
import dev.tamboui.buffer.Buffer;
import dev.tamboui.layout.Rect;
-import dev.tamboui.style.Color;
import dev.tamboui.style.Style;
import dev.tamboui.widget.Widget;
import org.apache.camel.diagram.TopologyLayoutEngine.TopologyLayoutNode;
import org.apache.camel.diagram.TopologyLayoutEngine.TopologyLayoutResult;
+import org.apache.camel.dsl.jbang.core.commands.tui.Theme;
public class TopologyMinimapWidget implements Widget {
- private static final Style CURRENT_STYLE = Style.EMPTY.fg(Color.YELLOW).bold();
- private static final Style OTHER_STYLE = Style.EMPTY.fg(Color.DARK_GRAY);
- private static final Style EXTERNAL_STYLE = Style.EMPTY.fg(Color.CYAN).dim();
-
private final TopologyLayoutResult layout;
private final String currentRouteId;
@@ -69,7 +65,7 @@ public class TopologyMinimapWidget implements Widget {
col = Math.max(0, col);
row = Math.max(0, row);
- Style style = isCurrent ? CURRENT_STYLE : OTHER_STYLE;
+ Style style = isCurrent ? Theme.label().bold() : Theme.muted();
drawMiniBox(buffer, area, col, row, nodeW, nodeH, style, isCurrent);
}
diff --git a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/resources/tui/themes/dark.tcss b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/resources/tui/themes/dark.tcss
index 123cf359f33b..1d9585f1765b 100644
--- a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/resources/tui/themes/dark.tcss
+++ b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/resources/tui/themes/dark.tcss
@@ -39,3 +39,18 @@ $dark-fg: #D4D4D4;
#mcp-down { color: #F48771; }
#base-bg { background: $dark-bg; }
#base-fg { color: $dark-fg; }
+
+/* Content tokens — labels, change indicators, search highlight */
+#label { color: #DCDCAA; }
+#change { color: #DCDCAA; }
+#search-match { color: black; background: #DCDCAA; }
+
+/* Diagram tokens */
+#diagram-border { color: #808080; }
+#diagram-id { color: $dark-fg; }
+#diagram-from { color: #4EC9B0; }
+#diagram-to { color: #56B6C2; }
+#diagram-choice { color: #DCDCAA; }
+#diagram-action { color: #C586C0; }
+#diagram-eip { color: #8957E5; }
+#diagram-default { color: #808080; }
diff --git a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/resources/tui/themes/light.tcss b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/resources/tui/themes/light.tcss
index 1cc88e46e3a4..0497a74b9b95 100644
--- a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/resources/tui/themes/light.tcss
+++ b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/resources/tui/themes/light.tcss
@@ -39,3 +39,18 @@ $light-fg: #24292E;
#mcp-down { color: #D73A49; }
#base-bg { background: $light-bg; }
#base-fg { color: $light-fg; }
+
+/* Content tokens — labels, change indicators, search highlight */
+#label { color: #735C00; }
+#change { color: #B08800; }
+#search-match { color: black; background: #FFD33D; }
+
+/* Diagram tokens */
+#diagram-border { color: #808080; }
+#diagram-id { color: $light-fg; }
+#diagram-from { color: #22863A; }
+#diagram-to { color: #0366D6; }
+#diagram-choice { color: #B08800; }
+#diagram-action { color: #6F42C1; }
+#diagram-eip { color: #5A32A3; }
+#diagram-default { color: #6A737D; }
diff --git a/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/CircuitBreakerTabRenderTest.java b/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/CircuitBreakerTabRenderTest.java
index 4fbf746c2121..2d2af443aafa 100644
--- a/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/CircuitBreakerTabRenderTest.java
+++ b/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/CircuitBreakerTabRenderTest.java
@@ -135,8 +135,9 @@ class CircuitBreakerTabRenderTest {
Frame frame = Frame.forTesting(buffer);
tab.render(frame, area);
- boolean foundYellow = TuiTestHelper.findCellWithColor(buffer, "h", Color.YELLOW);
- assertTrue(foundYellow, "half_open state should be rendered in YELLOW");
+ Color warningColor = Theme.warning().fg().orElse(Color.YELLOW);
+ boolean foundWarning = TuiTestHelper.findCellWithColor(buffer, "h", warningColor);
+ assertTrue(foundWarning, "half_open state should be rendered in warning color");
}
@Test
diff --git a/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/HttpTabRenderTest.java b/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/HttpTabRenderTest.java
index d7dd1b5bef92..925c53eb3079 100644
--- a/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/HttpTabRenderTest.java
+++ b/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/HttpTabRenderTest.java
@@ -102,8 +102,9 @@ class HttpTabRenderTest {
Frame frame = Frame.forTesting(buffer);
tab.render(frame, area);
- boolean foundYellow = TuiTestHelper.findCellWithColor(buffer, "P", Color.YELLOW);
- assertTrue(foundYellow, "POST method should be rendered in YELLOW");
+ Color labelColor = Theme.label().fg().orElse(Color.YELLOW);
+ boolean foundLabel = TuiTestHelper.findCellWithColor(buffer, "P", labelColor);
+ assertTrue(foundLabel, "POST method should be rendered in label color");
}
@Test
diff --git a/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/MonitorContextRenderTest.java b/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/MonitorContextRenderTest.java
index f9ee0f55eece..e15331b32844 100644
--- a/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/MonitorContextRenderTest.java
+++ b/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/MonitorContextRenderTest.java
@@ -24,6 +24,7 @@ import dev.tamboui.layout.Rect;
import dev.tamboui.style.Color;
import dev.tamboui.terminal.Frame;
import dev.tamboui.text.Span;
+import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -35,6 +36,11 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
*/
class MonitorContextRenderTest {
+ @BeforeEach
+ void setUp() {
+ Theme.resetForTesting();
+ }
+
@Test
void renderNoSelectionShowsPromptText() {
Rect area = new Rect(0, 0, 80, 10);
@@ -173,7 +179,8 @@ class MonitorContextRenderTest {
@Test
void sortStyleActiveColumnIsYellowBold() {
var style = AbstractTab.sortStyle("name", "name");
- assertEquals(Color.YELLOW, style.fg().orElse(null), "Active sort column should be YELLOW");
+ Color labelColor = Theme.label().fg().orElse(Color.YELLOW);
+ assertEquals(labelColor, style.fg().orElse(null), "Active sort column should be label color");
assertTrue(style.effectiveModifiers().contains(dev.tamboui.style.Modifier.BOLD),
"Active sort column should be BOLD");
}
@@ -181,8 +188,9 @@ class MonitorContextRenderTest {
@Test
void sortStyleInactiveColumnIsBoldOnly() {
var style = AbstractTab.sortStyle("name", "status");
- assertTrue(style.fg().isEmpty() || !Color.YELLOW.equals(style.fg().get()),
- "Inactive column should not be YELLOW");
+ Color labelColor = Theme.label().fg().orElse(Color.YELLOW);
+ assertTrue(style.fg().isEmpty() || !labelColor.equals(style.fg().get()),
+ "Inactive column should not be label color");
assertTrue(style.effectiveModifiers().contains(dev.tamboui.style.Modifier.BOLD),
"Inactive column should still be BOLD");
}
diff --git a/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/MonitorContextTest.java b/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/MonitorContextTest.java
index eae0656acb8a..6108ad33e7e7 100644
--- a/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/MonitorContextTest.java
+++ b/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/MonitorContextTest.java
@@ -19,6 +19,7 @@ package org.apache.camel.dsl.jbang.core.commands.tui;
import dev.tamboui.style.Color;
import dev.tamboui.style.Modifier;
import dev.tamboui.style.Style;
+import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -26,6 +27,11 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
class MonitorContextTest {
+ @BeforeEach
+ void setUp() {
+ Theme.resetForTesting();
+ }
+
// ---- formatSinceLast tests ----
@Test
@@ -180,7 +186,7 @@ class MonitorContextTest {
@Test
void topTimeStyleOver100ms() {
Style style = TuiHelper.topTimeStyle(500);
- assertEquals(Color.YELLOW, style.fg().orElse(null));
+ assertEquals(Theme.warning(), style);
}
@Test
diff --git a/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/SearchHighlighterTest.java b/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/SearchHighlighterTest.java
index 5459b7fec9de..53350f436e7f 100644
--- a/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/SearchHighlighterTest.java
+++ b/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/SearchHighlighterTest.java
@@ -25,6 +25,7 @@ import dev.tamboui.text.Span;
import dev.tamboui.tui.event.KeyCode;
import dev.tamboui.tui.event.KeyEvent;
import dev.tamboui.tui.event.KeyModifiers;
+import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -33,6 +34,11 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
class SearchHighlighterTest {
+ @BeforeEach
+ void setUp() {
+ Theme.resetForTesting();
+ }
+
// ---- applyHighlights tests ----
@Test
@@ -76,7 +82,7 @@ class SearchHighlighterTest {
boolean foundHighlight = false;
for (Span span : result.spans()) {
if (span.content().equals("err")) {
- assertEquals(SearchHighlighter.HIGHLIGHT_STYLE, span.style());
+ assertEquals(Theme.searchMatch(), span.style());
foundHighlight = true;
}
}
@@ -127,7 +133,7 @@ class SearchHighlighterTest {
boolean foundMatch = false;
for (Span span : result.spans()) {
if (span.content().equals("bar")) {
- assertEquals(SearchHighlighter.FIND_MATCH_STYLE, span.style());
+ assertEquals(Theme.searchMatch(), span.style());
foundMatch = true;
}
}
diff --git a/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/SqlTraceTabRenderTest.java b/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/SqlTraceTabRenderTest.java
index b52c5e53d7f3..d649b4924e25 100644
--- a/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/SqlTraceTabRenderTest.java
+++ b/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/SqlTraceTabRenderTest.java
@@ -104,8 +104,9 @@ class SqlTraceTabRenderTest {
Frame frame = Frame.forTesting(buffer);
tab.render(frame, area);
- boolean foundYellow = TuiTestHelper.findCellWithColor(buffer, "1", Color.YELLOW);
- assertTrue(foundYellow, "Slow query duration should be highlighted in YELLOW");
+ Color warningColor = Theme.warning().fg().orElse(Color.YELLOW);
+ boolean foundWarning = TuiTestHelper.findCellWithColor(buffer, "1", warningColor);
+ assertTrue(foundWarning, "Slow query duration should be highlighted in warning color");
}
@Test