diff --git a/tests/run.sh b/tests/run.sh index 5e6480f..1d5547f 100755 --- a/tests/run.sh +++ b/tests/run.sh @@ -2952,6 +2952,212 @@ print_coverage_summary() { printf 'Note: this is script-level behavioral coverage, not line coverage.\n' } +test_cliamp_uses_ansi_default_without_native() { + local home_dir="$TMP_ROOT/cliamp-ansi-home" + local hook_dir="$home_dir/.config/omarchy/hooks/theme-set.d" + local bin_dir="$TMP_ROOT/cliamp-ansi-bin" + local cfg="$home_dir/.config/cliamp/config.toml" + + write_colors_fixture "$home_dir" # theme ships no cliamp.toml -> ANSI default + mkdir -p "$hook_dir" "$bin_dir" "$(dirname "$cfg")" + cp "$ROOT_DIR/theme-set.d/50-cliamp.sh" "$hook_dir/50-cliamp.sh" + chmod +x "$hook_dir/50-cliamp.sh" + printf 'theme = "omarchy"\nvolume = -6\n[navidrome]\npassword = "p#1"\n' > "$cfg" + make_stub_bin "$bin_dir" cliamp 'exit 0' + + PATH="$bin_dir:$PATH" run_theme_hooks "$home_dir" >/dev/null + + assert_file_missing "$home_dir/.config/cliamp/themes/omarchy.toml" "cliamp ANSI mode writes no generated theme" + assert_contains "$(cat "$cfg")" 'theme = ""' "cliamp ANSI mode empties theme so cliamp uses its ANSI default" + assert_contains "$(cat "$cfg")" 'password = "p#1"' "cliamp ANSI mode preserves other config keys" +} + +test_cliamp_installs_canonical_native_dropping_inline_comments() { + local home_dir="$TMP_ROOT/cliamp-native-home" + local hook_dir="$home_dir/.config/omarchy/hooks/theme-set.d" + local bin_dir="$TMP_ROOT/cliamp-native-bin" + local theme_dir="$home_dir/.config/omarchy/current/theme" + local out="$home_dir/.config/cliamp/themes/omarchy.toml" + + write_colors_fixture "$home_dir" + mkdir -p "$hook_dir" "$bin_dir" + cp "$ROOT_DIR/theme-set.d/50-cliamp.sh" "$hook_dir/50-cliamp.sh" + chmod +x "$hook_dir/50-cliamp.sh" + # The theme ships its own cliamp.toml WITH inline comments. Older cliamp builds may reject these + # (folding the comment into the value), so the hook canonicalises. Real-binary oracle (run + # locally; CI has no cliamp): `cliamp theme list | grep -qx ' omarchy'`. Here we assert the + # canonical output that makes cliamp accept it (clean uppercased hex, no comments). + cat > "$theme_dir/cliamp.toml" <<'EOF' +# thpm:cliamp-use-native +accent = "#2488cb" # muted purple — primary interactive +bright_fg = "#d2833b" # warm parchment +fg = "#9287b0" # dim charcoal +green = "#238e9e" +yellow = "#d8979a" +red = "#D93C76" +EOF + make_stub_bin "$bin_dir" cliamp 'exit 0' + + PATH="$bin_dir:$PATH" run_theme_hooks "$home_dir" >/dev/null + + assert_file_exists "$out" "cliamp installs the theme's own cliamp.toml" + assert_contains "$(cat "$out")" 'accent = "#2488CB"' "cliamp native install canonicalises hex (uppercased)" + assert_not_contains "$(cat "$out")" "muted purple" "cliamp native install strips inline comments older cliamp builds would reject" + assert_contains "$(cat "$home_dir/.config/cliamp/config.toml")" 'theme = "omarchy"' "cliamp native install selects the omarchy theme" +} + +test_cliamp_falls_back_to_ansi_for_incomplete_native() { + local home_dir="$TMP_ROOT/cliamp-incomplete-home" + local hook_dir="$home_dir/.config/omarchy/hooks/theme-set.d" + local bin_dir="$TMP_ROOT/cliamp-incomplete-bin" + local theme_dir="$home_dir/.config/omarchy/current/theme" + + write_colors_fixture "$home_dir" + mkdir -p "$hook_dir" "$bin_dir" + cp "$ROOT_DIR/theme-set.d/50-cliamp.sh" "$hook_dir/50-cliamp.sh" + chmod +x "$hook_dir/50-cliamp.sh" + printf '# thpm:cliamp-use-native\naccent = "#2488cb"\nbright_fg = "#d2833b"\n' > "$theme_dir/cliamp.toml" # opted-in but only 2 of 6 keys + make_stub_bin "$bin_dir" cliamp 'exit 0' + + PATH="$bin_dir:$PATH" run_theme_hooks "$home_dir" >/dev/null + + assert_file_missing "$home_dir/.config/cliamp/themes/omarchy.toml" "cliamp drops an incomplete native cliamp.toml" + assert_contains "$(cat "$home_dir/.config/cliamp/config.toml")" 'theme = ""' "cliamp falls back to ANSI for an incomplete native theme" +} + +test_cliamp_ignores_native_without_opt_in_marker() { + local home_dir="$TMP_ROOT/cliamp-no-marker-home" + local hook_dir="$home_dir/.config/omarchy/hooks/theme-set.d" + local bin_dir="$TMP_ROOT/cliamp-no-marker-bin" + local theme_dir="$home_dir/.config/omarchy/current/theme" + + write_colors_fixture "$home_dir" + mkdir -p "$hook_dir" "$bin_dir" + cp "$ROOT_DIR/theme-set.d/50-cliamp.sh" "$hook_dir/50-cliamp.sh" + chmod +x "$hook_dir/50-cliamp.sh" + # A complete, valid cliamp.toml WITHOUT the opt-in marker (e.g. an auto-generated artifact). + # Mere existence must NOT activate native -> ANSI. + cat > "$theme_dir/cliamp.toml" <<'EOF' +accent = "#2488cb" +bright_fg = "#d2833b" +fg = "#9287b0" +green = "#238e9e" +yellow = "#d8979a" +red = "#d93c76" +EOF + make_stub_bin "$bin_dir" cliamp 'exit 0' + + PATH="$bin_dir:$PATH" run_theme_hooks "$home_dir" >/dev/null + + assert_file_missing "$home_dir/.config/cliamp/themes/omarchy.toml" "cliamp ignores a native cliamp.toml without the opt-in marker" + assert_contains "$(cat "$home_dir/.config/cliamp/config.toml")" 'theme = ""' "cliamp uses ANSI when a native theme lacks the opt-in marker" +} + +test_cliamp_requires_exact_opt_in_marker() { + local bin_dir="$TMP_ROOT/cliamp-nearmiss-bin" + local colors='accent = "#2488cb"\nbright_fg = "#d2833b"\nfg = "#9287b0"\ngreen = "#238e9e"\nyellow = "#d8979a"\nred = "#d93c76"\n' + local i=0 mark home_dir hook_dir theme_dir + + mkdir -p "$bin_dir" + make_stub_bin "$bin_dir" cliamp 'exit 0' + + # Only the EXACT line activates native. Near-misses (trailing text, leading whitespace, different + # case) must stay ANSI. The trailing-text case fails under a substring match (grep -qF), so it + # guards against loosening grep -qxF. (A marker inside a value is covered by the same whole-line + # match and needs no separate case.) + for mark in '# thpm:cliamp-use-native please' ' # thpm:cliamp-use-native' '# THPM:CLIAMP-USE-NATIVE'; do + i=$((i + 1)) + home_dir="$TMP_ROOT/cliamp-nearmiss-$i" + hook_dir="$home_dir/.config/omarchy/hooks/theme-set.d" + theme_dir="$home_dir/.config/omarchy/current/theme" + write_colors_fixture "$home_dir" + mkdir -p "$hook_dir" + cp "$ROOT_DIR/theme-set.d/50-cliamp.sh" "$hook_dir/50-cliamp.sh" + chmod +x "$hook_dir/50-cliamp.sh" + printf '%s\n%b' "$mark" "$colors" > "$theme_dir/cliamp.toml" + + PATH="$bin_dir:$PATH" run_theme_hooks "$home_dir" >/dev/null + + assert_file_missing "$home_dir/.config/cliamp/themes/omarchy.toml" "cliamp near-miss marker [$mark] does NOT activate native" + assert_contains "$(cat "$home_dir/.config/cliamp/config.toml")" 'theme = ""' "cliamp near-miss marker [$mark] falls back to ANSI" + done +} + +test_cliamp_fails_loud_when_config_cannot_be_created() { + local home_dir="$TMP_ROOT/cliamp-cfgfail-home" + local hook_dir="$home_dir/.config/omarchy/hooks/theme-set.d" + local bin_dir="$TMP_ROOT/cliamp-cfgfail-bin" + local cliamp_dir="$home_dir/.config/cliamp" + local output status + + write_colors_fixture "$home_dir" # no cliamp.toml -> ANSI path -> _set_theme creates config + mkdir -p "$hook_dir" "$bin_dir" "$cliamp_dir" + cp "$ROOT_DIR/theme-set.d/50-cliamp.sh" "$hook_dir/50-cliamp.sh" + chmod +x "$hook_dir/50-cliamp.sh" + make_stub_bin "$bin_dir" cliamp 'exit 0' + chmod 500 "$cliamp_dir" # config.toml cannot be created here + + output="$(PATH="$bin_dir:$PATH" HOME="$home_dir" XDG_CONFIG_HOME="$home_dir/.config" bash "$hook_dir/50-cliamp.sh" 2>&1)" + status=$? + chmod 700 "$cliamp_dir" + + if [[ "$status" -ne 0 ]]; then + pass "cliamp exits non-zero when config.toml cannot be created" + else + fail "cliamp exits non-zero when config.toml cannot be created" + fi + assert_not_contains "$output" "SUCCESS" "cliamp does not report SUCCESS when config write fails" +} + +test_cliamp_only_removes_its_exact_owned_file() { + local bin_dir="$TMP_ROOT/cliamp-owner-bin" + local h1="$TMP_ROOT/cliamp-owner-keep" + local h2="$TMP_ROOT/cliamp-owner-remove" + + mkdir -p "$bin_dir" + make_stub_bin "$bin_dir" cliamp 'exit 0' + + # (a) first line only CONTAINS the marker as a substring (e.g. a user backup) -> must be KEPT + write_colors_fixture "$h1" + mkdir -p "$h1/.config/omarchy/hooks/theme-set.d" "$h1/.config/cliamp/themes" + cp "$ROOT_DIR/theme-set.d/50-cliamp.sh" "$h1/.config/omarchy/hooks/theme-set.d/50-cliamp.sh" + chmod +x "$h1/.config/omarchy/hooks/theme-set.d/50-cliamp.sh" + printf '# thpm:cliamp-omarchy-backup\nmy backup\n' > "$h1/.config/cliamp/themes/omarchy.toml" + PATH="$bin_dir:$PATH" run_theme_hooks "$h1" >/dev/null + assert_file_exists "$h1/.config/cliamp/themes/omarchy.toml" "cliamp keeps a file whose first line only contains the owner marker as a substring" + + # (b) first line IS exactly the owner marker -> removed during ANSI tidy-up + write_colors_fixture "$h2" + mkdir -p "$h2/.config/omarchy/hooks/theme-set.d" "$h2/.config/cliamp/themes" + cp "$ROOT_DIR/theme-set.d/50-cliamp.sh" "$h2/.config/omarchy/hooks/theme-set.d/50-cliamp.sh" + chmod +x "$h2/.config/omarchy/hooks/theme-set.d/50-cliamp.sh" + printf '# thpm:cliamp-omarchy\nold\n' > "$h2/.config/cliamp/themes/omarchy.toml" + PATH="$bin_dir:$PATH" run_theme_hooks "$h2" >/dev/null + assert_file_missing "$h2/.config/cliamp/themes/omarchy.toml" "cliamp removes a file whose first line is exactly the owner marker" +} + +test_cliamp_native_handles_crlf_opt_in_marker() { + local home_dir="$TMP_ROOT/cliamp-crlf-home" + local hook_dir="$home_dir/.config/omarchy/hooks/theme-set.d" + local bin_dir="$TMP_ROOT/cliamp-crlf-bin" + local theme_dir="$home_dir/.config/omarchy/current/theme" + local out="$home_dir/.config/cliamp/themes/omarchy.toml" + + write_colors_fixture "$home_dir" + mkdir -p "$hook_dir" "$bin_dir" + cp "$ROOT_DIR/theme-set.d/50-cliamp.sh" "$hook_dir/50-cliamp.sh" + chmod +x "$hook_dir/50-cliamp.sh" + make_stub_bin "$bin_dir" cliamp 'exit 0' + # exact opt-in marker but CRLF line endings -> must still be recognised (not silently ANSI) + printf '# thpm:cliamp-use-native\r\naccent = "#2488cb"\r\nbright_fg = "#d2833b"\r\nfg = "#9287b0"\r\ngreen = "#238e9e"\r\nyellow = "#d8979a"\r\nred = "#d93c76"\r\n' > "$theme_dir/cliamp.toml" + + PATH="$bin_dir:$PATH" run_theme_hooks "$home_dir" >/dev/null + + assert_file_exists "$out" "cliamp recognises an exact opt-in marker with CRLF line endings" + assert_contains "$(cat "$out")" 'accent = "#2488CB"' "cliamp canonicalises a CRLF native theme" + assert_contains "$(cat "$home_dir/.config/cliamp/config.toml")" 'theme = "omarchy"' "cliamp selects the native theme for a CRLF opt-in file" +} + main() { test_shell_syntax test_installer_bundled_plugin_inventory_matches_hooks @@ -3015,6 +3221,14 @@ main() { test_foot_plugin_writes_osc_sequences_to_tty test_cava_plugin_writes_theme_and_updates_config test_cava_plugin_does_not_duplicate_theme_setting + test_cliamp_uses_ansi_default_without_native + test_cliamp_installs_canonical_native_dropping_inline_comments + test_cliamp_falls_back_to_ansi_for_incomplete_native + test_cliamp_ignores_native_without_opt_in_marker + test_cliamp_requires_exact_opt_in_marker + test_cliamp_fails_loud_when_config_cannot_be_created + test_cliamp_only_removes_its_exact_owned_file + test_cliamp_native_handles_crlf_opt_in_marker test_superfile_plugin_writes_theme_and_requests_restart test_swaync_plugin_installs_theme_files_and_reloads test_swaync_plugin_prefers_named_theme_over_current_theme diff --git a/theme-set.d/50-cliamp.sh b/theme-set.d/50-cliamp.sh index d7d2eee..33e59d5 100755 --- a/theme-set.d/50-cliamp.sh +++ b/theme-set.d/50-cliamp.sh @@ -1,67 +1,117 @@ #!/usr/bin/env bash -source "${THPM_THEME_ENV:-$HOME/.local/share/thpm/lib/theme-env.sh}" +# Themes cliamp on an Omarchy theme switch. +# +# cliamp's loaded-theme format has only 6 colours and hard-couples Title / Accent / SeekBar AND the +# key-hint pill background onto the single `accent` field (ui/styles.go). Mechanically reducing a +# 16-colour palette into those 6 fields looks worse than cliamp's OWN ANSI default, which maps each +# role to a distinct ANSI index — title=10, accent=11, key-bg=8 (neutral), key-fg=15 — rendered in +# the terminal's themed palette. cliamp ignores any extra keys (title/seek/key_bg have no effect), +# so a richer omarchy.toml is impossible without an upstream schema change. +# +# Therefore this hook does NOT derive a palette. It either: +# 1. installs a theme's own cliamp.toml ONLY when it opts in via the exact NATIVE_OPT_IN marker +# (a cliamp.toml is often auto-generated, so its mere existence is not an author opt-in), or +# 2. removes our generated file and sets `theme = ""`, which cliamp treats as its ANSI default +# (ui/model SetTheme: name=="" -> applyThemeAll(theme.Default()) — verified first-class path). -if ! command -v cliamp >/dev/null 2>&1; then - skipped "cliamp" -fi +config_root="${XDG_CONFIG_HOME:-$HOME/.config}" +theme_dir="$config_root/cliamp/themes" +config_file="$config_root/cliamp/config.toml" +target="$theme_dir/omarchy.toml" +MARKER="# thpm:cliamp-omarchy" +# Opt-in marker an author must add to a theme's cliamp.toml. A cliamp.toml is often an +# auto-generated artifact (e.g. by a palette generator committed to the theme repo), so its mere +# existence is NOT a deliberate choice to use it. Only an EXACT matching line activates native; +# without it the hook uses cliamp's (richer) ANSI default. +NATIVE_OPT_IN="# thpm:cliamp-use-native" -theme_dir="$HOME/.config/cliamp/themes" -mkdir -p "$theme_dir" +success() { echo -e "\e[32m[SUCCESS]\e[0m $1"; } +warning() { echo -e "\033[0;33m[WARNING]\e[0m $1"; } +error() { echo -e "\e[31m[ERROR]\e[0m $1"; exit 1; } +skipped() { echo -e "\033[0;34m[SKIPPED]\e[0m $1 not found. Skipping.."; exit 0; } -# Relative luminance scaled to 0-255 (integer, no external deps). -_lum() { - local r=$((16#${1:0:2})) g=$((16#${1:2:2})) b=$((16#${1:4:2})) - echo $(( (2126 * r + 7152 * g + 722 * b) / 10000 )) -} +command -v cliamp >/dev/null 2>&1 || skipped "cliamp" -# cliamp maps bright_fg -> normal text, fg -> dimmed text, so bright_fg must be -# the brighter of the two. Some palettes define color15 darker than color7, which -# would invert that, so pick by luminance instead of trusting the names. -if [ "$(_lum "$bright_white")" -ge "$(_lum "$normal_white")" ]; then - fg_bright="$bright_white"; fg_dim="$normal_white" -else - fg_bright="$normal_white"; fg_dim="$bright_white" -fi +# ---- resolve the active theme directory (same chain thpm uses for colors_file) ---- +_expand() { case "$1" in "~") printf '%s\n' "$HOME";; "~/"*) printf '%s/%s\n' "$HOME" "${1#\~/}";; *) printf '%s\n' "$1";; esac; } +THPM_CONFIG_FILE="${THPM_CONFIG_FILE:-$config_root/thpm/config.toml}" +_cfg() { + [ -f "$THPM_CONFIG_FILE" ] || return 0 + awk -v s="$1" -v k="$2" -v SQ="'" ' + function strip(x, i,c,q,o){ q=""; o=""; for(i=1;i<=length(x);i++){ c=substr(x,i,1); if(q==""){ if(c=="\""||c==SQ){q=c;o=o c;continue} if(c=="#")break; o=o c } else { o=o c; if(c==q)q="" } } return o } + function trim(x){ gsub(/^[[:space:]]+|[[:space:]]+$/,"",x); return x } + function unq(x, f,l){ if(length(x)>=2){f=substr(x,1,1);l=substr(x,length(x),1); if((f=="\""&&l=="\"")||(f==SQ&&l==SQ))return substr(x,2,length(x)-2)} return x } + /^[[:space:]]*\[/ { sec=$0; gsub(/[][[:space:]]/,"",sec); next } + { lhs=$0; sub(/=.*/,"",lhs); gsub(/[[:space:]]/,"",lhs) + if (sec==s && lhs==k) { r=$0; sub(/^[^=]*=/,"",r); print unq(trim(strip(r))); exit } }' "$THPM_CONFIG_FILE" +} +if [ -n "${THPM_COLORS_FILE:-}" ]; then colors_file="$THPM_COLORS_FILE" +else cf="$(_cfg paths colors_file)"; [ -n "$cf" ] && colors_file="$(_expand "$cf")" || colors_file="$config_root/omarchy/current/theme/colors.toml"; fi +theme_src="$(dirname "$colors_file")" -# cliamp uses accent for the title, seek bar AND the key-hint background, so it -# must stand out from the terminal background. Prefer the theme's blue, but if it -# sits too close to the background (e.g. monochrome themes) fall back to the most -# contrasting candidate so those elements stay readable. -bg_lum="$(_lum "$primary_background")" -accent="$normal_blue" -acc_diff=$(( $(_lum "$accent") - bg_lum )); acc_diff=${acc_diff#-} -if [ "$acc_diff" -lt 80 ]; then - accent="" - # first try a readable *coloured* accent (keeps a visual accent)… - for cand in "$bright_blue" "$normal_cyan" "$normal_yellow" "$normal_green" "$normal_red"; do - [ -n "$cand" ] || continue - cand_diff=$(( $(_lum "$cand") - bg_lum )); cand_diff=${cand_diff#-} - [ "$cand_diff" -ge 80 ] && { accent="$cand"; break; } - done - # …otherwise fall back to the readable foreground colour - [ -n "$accent" ] || accent="$fg_bright" -fi +mkdir -p "$theme_dir" -cat > "$theme_dir/omarchy.toml" << EOF -# Omarchy theme for cliamp -# Generated by thpm — do not edit manually. +# ---- atomic top-level `theme = "$1"` in config.toml (before first [table]; preserves other keys) ---- +_set_theme() { + local val="$1" ctmp + if [ ! -f "$config_file" ]; then printf 'theme = "%s"\n' "$val" > "$config_file" || error "failed creating $config_file"; return; fi + ctmp="$(dirname "$config_file")/.config.$$" + awk -v val="$val" ' + BEGIN { done=0; seen=0 } + /^[[:space:]]*\[/ { if (!done && !seen) { printf "theme = \"%s\"\n", val; done=1 } seen=1; print; next } + (!seen && $0 ~ /^[[:space:]]*theme[[:space:]]*=/) { if (!done) { printf "theme = \"%s\"\n", val; done=1 } next } + { print } END { if (!done) printf "theme = \"%s\"\n", val }' "$config_file" > "$ctmp" \ + || { rm -f "$ctmp"; error "failed updating $config_file"; } + mv -f "$ctmp" "$config_file" || { rm -f "$ctmp"; error "failed updating $config_file"; } +} +_remove_marker_file() { [ -f "$target" ] && head -n1 "$target" | tr -d '\r' | grep -qxF "$MARKER" && rm -f "$target"; } -accent = "#${accent}" -bright_fg = "#${fg_bright}" -fg = "#${fg_dim}" -green = "#${normal_green}" -yellow = "#${normal_yellow}" -red = "#${normal_red}" -EOF +# comment/quote-safe TOML value extractor: $1=file $2=key -> normalised #RRGGBB (3-digit expanded) +# or empty. Older cliamp builds may reject inline comments, so we canonicalise before install. +_toml_hex() { + awk -v k="$2" -v SQ="'" ' + function strip_comment(s, i,c,q,o){ q=""; o=""; for(i=1;i<=length(s);i++){ c=substr(s,i,1); if(q==""){ if(c=="\""||c==SQ){q=c;o=o c;continue} if(c=="#")break; o=o c } else { o=o c; if(c==q)q="" } } return o } + function trim(s){ gsub(/^[[:space:]]+|[[:space:]]+$/,"",s); return s } + function unq(s, f,l){ if(length(s)>=2){f=substr(s,1,1);l=substr(s,length(s),1); if((f=="\""&&l=="\"")||(f==SQ&&l==SQ))return substr(s,2,length(s)-2)} return s } + { l=$0; sub(/=.*/,"",l); gsub(/[[:space:]]/,"",l) + if (l==k) { r=$0; sub(/^[^=]*=/,"",r); v=unq(trim(strip_comment(r))) + if (v ~ /^#[0-9A-Fa-f]{6}$/) { print toupper(v); exit } + if (v ~ /^#[0-9A-Fa-f]{3}$/) { v=toupper(v); printf "#%s%s%s%s%s%s\n", substr(v,2,1),substr(v,2,1),substr(v,3,1),substr(v,3,1),substr(v,4,1),substr(v,4,1); exit } + exit } }' "$1" +} -config_file="$HOME/.config/cliamp/config.toml" -if [ -f "$config_file" ]; then - if grep -q '^theme = ' "$config_file"; then - sed -i 's/^theme = ".*"/theme = "omarchy"/' "$config_file" - else - echo 'theme = "omarchy"' >> "$config_file" +# ===== 1. theme ships a cliamp.toml AND opts in via the exact NATIVE_OPT_IN line -> CANONICALISE +# its 6 colours (drop inline comments, which older cliamp builds may fold into the value +# and reject; normalise hex) and install. No opt-in marker -> ANSI default. ===== +native="$theme_src/cliamp.toml" +if [ -f "$native" ] && tr -d '\r' < "$native" | grep -qxF "$NATIVE_OPT_IN"; then + declare -A NV; usable=1 + for k in accent bright_fg fg green yellow red; do + v=$(_toml_hex "$native" "$k"); [ -n "$v" ] && NV[$k]="$v" || { usable=0; break; } + done + if [ "$usable" = 1 ]; then + tmp="$theme_dir/.omarchy.toml.$$" + { + echo "$MARKER" + echo "# Installed by thpm from the theme's own cliamp.toml (canonicalised) — do not edit." + echo + printf 'accent = "%s"\n' "${NV[accent]}" + printf 'bright_fg = "%s"\n' "${NV[bright_fg]}" + printf 'fg = "%s"\n' "${NV[fg]}" + printf 'green = "%s"\n' "${NV[green]}" + printf 'yellow = "%s"\n' "${NV[yellow]}" + printf 'red = "%s"\n' "${NV[red]}" + } > "$tmp" && mv -f "$tmp" "$target" || { rm -f "$tmp"; error "failed installing cliamp.toml"; } + _set_theme omarchy + success "cliamp themed from the theme's own cliamp.toml." + exit 0 fi + warning "theme's cliamp.toml is incomplete/invalid — using cliamp's ANSI default instead." fi -success "cliamp theme updated!" +# ===== 2. no usable native theme -> theme="" so cliamp uses its (richer) ANSI default ===== +# theme="" alone activates ANSI regardless of any file; we also drop our marker-owned file to stay tidy. +_remove_marker_file +_set_theme "" +success "cliamp set to its ANSI default (no palette reduction — richer per-role mapping)." exit 0