Skip to content

Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows

feat: add color palette to show-theme (#1185)

Maximilian Roos7b7c0b12d229
diff --git a/src/cli/config.rs b/src/cli/config.rs
index dc4b55fad..849ae559b 100644
--- a/src/cli/config.rs
+++ b/src/cli/config.rs
@@ -136,7 +136,8 @@ Detects various forms of the integration pattern regardless of:
- Progress, success, error, warning, hint, info
- Gutter formatting for quoted content
-- Prompts for user input"#
+- Prompts for user input
+- Color palette showing each color rendered in itself"#
)]
ShowTheme,
diff --git a/src/commands/configure_shell.rs b/src/commands/configure_shell.rs
index 5c1bf6548..07b524fa9 100644
--- a/src/commands/configure_shell.rs
+++ b/src/commands/configure_shell.rs
@@ -1330,6 +1330,66 @@ pub fn handle_show_theme() {
// Prompt
eprintln!("{}", info_message("Prompt formatting:"));
eprintln!("{} ", prompt_message("Proceed? [y/N]"));
+
+ eprintln!();
+
+ // Color palette — each color rendered in itself
+ eprintln!("{}", info_message("Color palette:"));
+ use anstyle::{AnsiColor, Color};
+ let fg = |c: AnsiColor| Some(Color::Ansi(c));
+ let palette: &[(&str, Style)] = &[
+ ("red", Style::new().fg_color(fg(AnsiColor::Red))),
+ ("green", Style::new().fg_color(fg(AnsiColor::Green))),
+ ("yellow", Style::new().fg_color(fg(AnsiColor::Yellow))),
+ ("blue", Style::new().fg_color(fg(AnsiColor::Blue))),
+ ("cyan", Style::new().fg_color(fg(AnsiColor::Cyan))),
+ ("bold", Style::new().bold()),
+ ("dim", Style::new().dimmed()),
+ ("bold red", Style::new().fg_color(fg(AnsiColor::Red)).bold()),
+ (
+ "bold green",
+ Style::new().fg_color(fg(AnsiColor::Green)).bold(),
+ ),
+ (
+ "bold yellow",
+ Style::new().fg_color(fg(AnsiColor::Yellow)).bold(),
+ ),
+ (
+ "bold cyan",
+ Style::new().fg_color(fg(AnsiColor::Cyan)).bold(),
+ ),
+ (
+ "dim bright-black",
+ Style::new().fg_color(fg(AnsiColor::BrightBlack)).dimmed(),
+ ),
+ (
+ "dim blue",
+ Style::new().fg_color(fg(AnsiColor::Blue)).dimmed(),
+ ),
+ (
+ "dim green",
+ Style::new().fg_color(fg(AnsiColor::Green)).dimmed(),
+ ),
+ (
+ "dim cyan",
+ Style::new().fg_color(fg(AnsiColor::Cyan)).dimmed(),
+ ),
+ (
+ "dim magenta",
+ Style::new().fg_color(fg(AnsiColor::Magenta)).dimmed(),
+ ),
+ (
+ "dim yellow",
+ Style::new().fg_color(fg(AnsiColor::Yellow)).dimmed(),
+ ),
+ ];
+
+ let palette_text: String = palette
+ .iter()
+ .map(|(name, style)| format!("{style}{name}{style:#}"))
+ .collect::<Vec<_>>()
+ .join("\n");
+ eprintln!("{}", format_with_gutter(&palette_text, None));
}
#[cfg(test)]
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__config_show_theme__show_theme.snap b/tests/integration_tests/snapshots/integration__integration_tests__config_show_theme__show_theme.snap
index b900d4ad7..8fa52b80e 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__config_show_theme__show_theme.snap
+++ b/tests/integration_tests/snapshots/integration__integration_tests__config_show_theme__show_theme.snap
@@ -16,10 +16,13 @@ info:
RUST_LOG: warn
SHELL: ""
TERM: alacritty
+ WORKTRUNK_APPROVALS_PATH: /nonexistent/test/approvals.toml
WORKTRUNK_CONFIG_PATH: /nonexistent/test/config.toml
+ WORKTRUNK_SYSTEM_CONFIG_PATH: /etc/xdg/worktrunk/config.toml
WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
WORKTRUNK_TEST_EPOCH: "1735776000"
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
WORKTRUNK_TEST_POWERSHELL_ENV: "0"
WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
---
@@ -52,4 +55,23 @@ exit_code: 0
  cp {{ repo_root }}/target {{ worktree }}/target
○ Prompt formatting:
-❯ Proceed? [y/N]
+❯ Proceed? [y/N]
+
+○ Color palette:
+  red
+  green
+  yellow
+  blue
+  cyan
+  bold
+  dim
+  bold red
+  bold green
+  bold yellow
+  bold cyan
+  dim bright-black
+  dim blue
+  dim green
+  dim cyan
+  dim magenta
+  dim yellow