CAMEL-23839: camel-jbang TUI - switchable light/dark CSS theme#24322
CAMEL-23839: camel-jbang TUI - switchable light/dark CSS theme#24322ammachado wants to merge 18 commits into
Conversation
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
davsclaus
left a comment
There was a problem hiding this comment.
Nice work on the CSS-backed theming! The Theme class design is solid — semantic token names, graceful CSS fallback with a single log warning (never crashes), and proper test coverage including persistence roundtrip.
A few observations:
- The PR bundles some unrelated changes with the theme feature (tamboui API migration
ke.character()→ke.string().charAt(0),@SuppressWarningscleanup, stream API refactoring inDataRefreshService,Sizeconstructor migration, test cleanup). Each is individually correct, but splitting them into separate commits would make the git history easier to navigate. HINT_KEY_STYLEis a non-theme-switchable constant (black-on-orange in both themes). Intentional? Or should it also resolve throughTheme?- CI: JDK 25 build failed on
mvn test, JDK 17 was cancelled. Likely pre-existing but worth confirming.
Overall the core feature is well-designed and well-documented (upgrade guide, TUI manual, help text all updated). LGTM.
This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.
Claude Code on behalf of Claus Ibsen
…t, zebra rows, Overview empty state - Add emoji glyphs to tab labels and an orange-background highlight for the active tab - Zebra-stripe Overview integration/infra rows for readability - Add an empty-state instructions page when no integrations are running Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> # Conflicts: # dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/CamelMonitor.java
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> ^ Conflicts: ^ dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/CamelMonitor.java
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The theme toggle was bound to Shift+T while the help text, the TUI doc
page, and the upgrade guide all advertised F4. Shift+T also collided
with the RoutesTab "top mode" toggle (isCharIgnoreCase('t')), which the
global handler shadowed. Bind the toggle to the free F4 key so the code
matches the documented shortcut and frees Shift+T.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The MCP footer indicator still emitted raw ANSI colors for its active/idle/down dot, so it did not follow the light stylesheet. Add dedicated mcp-active / mcp-idle / mcp-down tokens to both stylesheets and Theme accessors (with built-in fallbacks mirroring the dark theme), and point the indicator at them. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The integration and infra status cells still used raw ANSI colors, so they did not adapt to the light stylesheet. Map them to the semantic Theme tokens (success/warning/error), matching the header chrome. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Replace the placeholder camel with a clearer silhouette: a smaller head, a distinct hump, and three legs with feet, so the empty/no-selection state reads as a camel rather than a big-headed horse. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The emoji tab icons added ~3 columns per tab, overflowing the tab-bar width budget that was tuned to the cell (compact labels fit at MIN_WIDTH 88, full labels at TABS_FULL_MIN_WIDTH 126). Remove the emoji to restore the fit on small and medium terminals; a themed per-tab icon can be reintroduced on the content border later. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The empty/no-selection panel built a rounded Block but never set borders(Borders.ALL), so no border was drawn (every other panel sets it). Add the borders, and render the F6/?/F1 key hints as orange HINT_KEY_STYLE chips instead of literal [F6]/[?]/[F1] text, matching the footers and the other tabs. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add inner spacing to the F1/? and arrow key chips in the help overlay footer so they match the chip styling used elsewhere.
Move the black-on-orange key-hint chip into the CSS-backed Theme like every other token. Adds a #hint-key token to dark.tcss/light.tcss and a Theme.hintKey() accessor, replacing the hardcoded HINT_KEY_STYLE constant in MonitorContext and its call sites. This makes the chip theme-resolved (it was a static final, frozen at class load) and corrects the accentBg() javadoc that no longer covers hint keys. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
ℹ️ CI did not run targeted module tests (skip-tests label detected). |
davsclaus
left a comment
There was a problem hiding this comment.
Clean, well-structured PR. The theme centralization replaces scattered inline colors with semantic Theme accessors backed by CSS stylesheets — a clear improvement. The fallback palette is defensive (cosmetic failure never crashes the TUI), and ThemeTest covers both palettes, toggle, persistence round-trip, and null safety. Documentation (upgrade guide + TUI manual) is updated and matches the implementation.
A few minor observations (none blocking):
- Several non-theme cleanups are bundled (deprecated API migration,
@SuppressWarningsremovals,noneMatch→allMatch,DataRefreshServicenull check fix). The commite51d09dbgroups them intentionally, which is reasonable. Themethread safety is pragmatically fine —accent()andzebra()resolve outside the synchronized block, but the TUI event loop is single-threaded so there's no real race.
Note: CI was running a full 673-module build because the root pom.xml .tcss formatter entry triggered Scalpel to cascade. The incremental-skip-tests label has been applied to unblock.
This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.
Description
Introduces a switchable, CSS-backed theme for the Camel JBang TUI (
camel tui), replacing the previously hard-coded inline colors with a central semanticTheme.What's new
Themeis the single semantic source of truth for TUI styles (borders, status colors, accents, zebra rows, selection, empty-state, MCP indicator, key-hint chips, ...).dark.tcss/light.tcss, backed bytamboui-css) define the palettes. Two ship: dark (default) and light.camel.tui.theme(dark/light) in.camel-jbang-user.propertiesand restored on the next launch.Visual polish included
Screenshots
Notes for reviewers
Theme.hintKey()/ a#hint-keyCSS token instead of a hard-codedHINT_KEY_STYLEconstant (addresses review feedback). It was astatic finalthat could never track a runtime theme toggle; behavior is unchanged today (black-on-orange in both palettes) but it is now wired through the engine like every other color.MIN_WIDTH=88, full atTABS_FULL_MIN_WIDTH=126) on small/medium terminals, so they were removed. A themed per-tab icon rendered on the content border is a possible follow-up.ThemeTestcovers token resolution for both palettes (including the newhint-keytoken), the theme toggle, and persistence to user config.Target
mainbranch)Tracking
JIRA: https://issues.apache.org/jira/browse/CAMEL-23839
Apache Camel coding standards and style
mvn clean install -DskipTestslocally from root folder and I have committed all auto-generated changes.AI-assisted contributions
Co-authored-bytrailers) and the PR description identifies the AI tool used.AI tool used: Claude Code (Opus 4.8), on behalf of Adriano Machado.