Rename bg/fg palette keys to background/foreground

The canonical colors.toml keys are now background/foreground, including
all permutations (dark_background, darker_background, lighter_background,
dark_foreground, light_foreground, bright_foreground). The old short
names are gone entirely, not kept as aliases; legacy alacritty-generated
themes still resolve through the ANSI color0/color7 fallback.

Theme files are also regrouped: accent/selection/muted first, then the
backgrounds, then the foregrounds, then the named colors.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
David Heinemeier Hansson
2026-07-18 16:24:51 -07:00
co-authored by Claude Fable 5
parent 72d7646c64
commit afa2839a5a
46 changed files with 747 additions and 718 deletions
+19 -19
View File
@@ -220,8 +220,8 @@ cat >"$NEXT_THEME/colors.toml" <<'EOF'
mode = "light"
accent = "#336699"
hyprland_active_border = "rgba(010203ee) rgba(040506ee) 45deg"
bg = "#000000"
fg = "#ffffff"
background = "#000000"
foreground = "#ffffff"
selection = "#808080"
red = "#ff0000"
green = "#00ff00"
@@ -236,13 +236,13 @@ bright_yellow = "#ffff11"
bright_blue = "#1111ff"
bright_magenta = "#ff11ff"
bright_cyan = "#11ffff"
bright_fg = "#eeeeee"
bright_foreground = "#eeeeee"
EOF
cat >"$USER_THEMED/mix-test.txt.tpl" <<'EOF'
mix={{ mix bg fg 50% }}
strip={{ mix_strip bg fg 50% }}
rgb={{ mix_rgb bg fg 50% }}
mix={{ mix background foreground 50% }}
strip={{ mix_strip background foreground 50% }}
rgb={{ mix_rgb background foreground 50% }}
EOF
cat >"$USER_THEMED/gradient-test.txt.tpl" <<'EOF'
@@ -262,8 +262,8 @@ magenta={{ magenta }}
legacy-purple={{ purple }}
bright-magenta={{ bright_magenta }}
legacy-bright-purple={{ bright_purple }}
legacy-background={{ background }}
legacy-foreground={{ foreground }}
background={{ background }}
foreground={{ foreground }}
selection-background={{ selection_background }}
selection-foreground={{ selection_foreground }}
cursor-alias={{ cursor }}
@@ -288,11 +288,11 @@ grep -qx 'magenta=#ff00ff' "$NEXT_THEME/alias-test.txt" || fail "theme template
grep -qx 'legacy-purple=#ff00ff' "$NEXT_THEME/alias-test.txt" || fail "theme template purple alias works"
grep -qx 'bright-magenta=#ff11ff' "$NEXT_THEME/alias-test.txt" || fail "theme template bright magenta helper works"
grep -qx 'legacy-bright-purple=#ff11ff' "$NEXT_THEME/alias-test.txt" || fail "theme template bright purple alias works"
grep -qx 'legacy-background=#000000' "$NEXT_THEME/alias-test.txt" || fail "theme template legacy background alias works"
grep -qx 'legacy-foreground=#ffffff' "$NEXT_THEME/alias-test.txt" || fail "theme template legacy foreground alias works"
grep -qx 'background=#000000' "$NEXT_THEME/alias-test.txt" || fail "theme template resolves background"
grep -qx 'foreground=#ffffff' "$NEXT_THEME/alias-test.txt" || fail "theme template resolves foreground"
grep -qx 'selection-background=#808080' "$NEXT_THEME/alias-test.txt" || fail "theme template derives selection background from selection"
grep -qx 'selection-foreground=#eeeeee' "$NEXT_THEME/alias-test.txt" || fail "theme template derives selection foreground from bright_fg"
grep -qx 'cursor-alias=#eeeeee' "$NEXT_THEME/alias-test.txt" || fail "theme template derives cursor alias from bright_fg"
grep -qx 'selection-foreground=#eeeeee' "$NEXT_THEME/alias-test.txt" || fail "theme template derives selection foreground from bright_foreground"
grep -qx 'cursor-alias=#eeeeee' "$NEXT_THEME/alias-test.txt" || fail "theme template derives cursor alias from bright_foreground"
pass "theme template semantic aliases expose legacy colorN helpers"
osc_summary=$("$ROOT/bin/omarchy-theme-osc" "$NEXT_THEME/colors.toml" | python -c 'import sys; data = sys.stdin.buffer.read(); print(data.count(b"]4;"), b"]4;1;#ff0000" in data, b"]4;7;#ffffff" in data, b"]4;15;#eeeeee" in data, b"]12;#eeeeee" in data, b"]17;#808080" in data, b"]19;#eeeeee" in data)')
@@ -300,18 +300,18 @@ osc_summary=$("$ROOT/bin/omarchy-theme-osc" "$NEXT_THEME/colors.toml" | python -
pass "theme OSC aliases semantic colors to ANSI palette"
preview_output=$(OMARCHY_PATH="$ROOT" HOME="$PI_TMPDIR" "$ROOT/bin/omarchy-dev-theme-preview" "$NEXT_THEME/colors.toml" --no-color)
assert_output_contains "theme preview shows bg to bright_fg gradient" "$preview_output" "bg -> bright_fg gradient"
assert_output_contains "theme preview shows background to bright_foreground gradient" "$preview_output" "background -> bright_foreground gradient"
assert_output_contains "theme preview orders light mode ramp light to dark" "$preview_output" "Neutral ramp (lightest -> darkest)"
assert_output_contains "theme preview includes dark background slots" "$preview_output" "darker_bg"
assert_output_contains "theme preview includes dark background slots" "$preview_output" "darker_background"
assert_output_contains "theme preview shows selected text sample" "$preview_output" "This is some [selected text] in a sentence"
assert_output_contains "theme preview shows practical terminal samples" "$preview_output" "Terminal/UI samples"
assert_output_contains "theme preview shows ANSI palette strips" "$preview_output" "ANSI palette strips"
tokyo_fg=$(awk -F'"' '/^fg =/ { print $2; exit }' "$ROOT/themes/tokyo-night/colors.toml")
tokyo_light_fg=$(awk -F'"' '/^light_fg =/ { print $2; exit }' "$ROOT/themes/tokyo-night/colors.toml")
tokyo_bright_fg=$(awk -F'"' '/^bright_fg =/ { print $2; exit }' "$ROOT/themes/tokyo-night/colors.toml")
[[ $tokyo_fg == "#a9b1d6" && $tokyo_light_fg == "#b4bee6" && $tokyo_bright_fg == "#c0caf5" ]] || fail "tokyo night fg ramp stays ordered"
pass "tokyo night fg ramp stays ordered"
tokyo_fg=$(awk -F'"' '/^foreground =/ { print $2; exit }' "$ROOT/themes/tokyo-night/colors.toml")
tokyo_light_fg=$(awk -F'"' '/^light_foreground =/ { print $2; exit }' "$ROOT/themes/tokyo-night/colors.toml")
tokyo_bright_fg=$(awk -F'"' '/^bright_foreground =/ { print $2; exit }' "$ROOT/themes/tokyo-night/colors.toml")
[[ $tokyo_fg == "#a9b1d6" && $tokyo_light_fg == "#b4bee6" && $tokyo_bright_fg == "#c0caf5" ]] || fail "tokyo night foreground ramp stays ordered"
pass "tokyo night foreground ramp stays ordered"
if rg -q '^cursor\s*=' "$ROOT/themes" -g'colors.toml'; then
fail "built-in colors.toml files omit cursor token"