style(omnibox): soften default-order badge
Restyle the header badge as a passive state chip so it stops competing with primary actions. The smaller neutral treatment still hints interactivity on hover without reading like a button.
- commit
- 7e507f9b153e17e9a7384a815b6e8b010b2f924b
- author
- brice · · 2026-04-12 04:10 UTC
- parent
- 32b1250
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
2 files · +50 -0
M internal/ui/theme/css.go +18 -0
| @@ -407,6 +407,24 @@ entry.omnibox-entry > text:focus-visible { | |||
| 407 | 407 | font-weight: 600; | |
| 408 | 408 | } | |
| 409 | 409 | ||
| 410 | + | /* Header badge used for omnibox state */ | |
| 411 | + | .omnibox-header-badge { | |
| 412 | + | background-color: alpha(var(--surface-variant), 0.65); | |
| 413 | + | color: var(--muted); | |
| 414 | + | border: 0.0625em solid alpha(var(--border), 0.85); | |
| 415 | + | border-radius: 0.1875em; | |
| 416 | + | padding: 0.0625em 0.375em; | |
| 417 | + | font-size: 0.6875em; | |
| 418 | + | font-weight: 500; | |
| 419 | + | transition: background-color 100ms ease-in-out, border-color 100ms ease-in-out, color 100ms ease-in-out; | |
| 420 | + | } | |
| 421 | + | ||
| 422 | + | .omnibox-header-badge:hover { | |
| 423 | + | background-color: shade(var(--surface-variant), 1.08); | |
| 424 | + | border-color: var(--border); | |
| 425 | + | color: var(--text); | |
| 426 | + | } | |
| 427 | + | ||
| 410 | 428 | /* Zoom indicator in omnibox header */ | |
| 411 | 429 | .omnibox-zoom-indicator { | |
| 412 | 430 | background-color: alpha(var(--accent), 0.2); | |
| @@ -407,6 +407,24 @@ entry.omnibox-entry > text:focus-visible { | |||||
| 407 | font-weight: 600; | 407 | font-weight: 600; | ||
| 408 | } | 408 | } | ||
| 409 | 409 | ||||
| 410 | + | /* Header badge used for omnibox state */ | |||
| 411 | + | .omnibox-header-badge { | |||
| 412 | + | background-color: alpha(var(--surface-variant), 0.65); | |||
| 413 | + | color: var(--muted); | |||
| 414 | + | border: 0.0625em solid alpha(var(--border), 0.85); | |||
| 415 | + | border-radius: 0.1875em; | |||
| 416 | + | padding: 0.0625em 0.375em; | |||
| 417 | + | font-size: 0.6875em; | |||
| 418 | + | font-weight: 500; | |||
| 419 | + | transition: background-color 100ms ease-in-out, border-color 100ms ease-in-out, color 100ms ease-in-out; | |||
| 420 | + | } | |||
| 421 | + | ||||
| 422 | + | .omnibox-header-badge:hover { | |||
| 423 | + | background-color: shade(var(--surface-variant), 1.08); | |||
| 424 | + | border-color: var(--border); | |||
| 425 | + | color: var(--text); | |||
| 426 | + | } | |||
| 427 | + | ||||
| 410 | /* Zoom indicator in omnibox header */ | 428 | /* Zoom indicator in omnibox header */ | ||
| 411 | .omnibox-zoom-indicator { | 429 | .omnibox-zoom-indicator { | ||
| 412 | background-color: alpha(var(--accent), 0.2); | 430 | background-color: alpha(var(--accent), 0.2); | ||
M internal/ui/theme/css_test.go +32 -0
| @@ -34,6 +34,38 @@ func TestGenerateCSS_OmniboxHeaderIsOpaque(t *testing.T) { | |||
| 34 | 34 | } | |
| 35 | 35 | } | |
| 36 | 36 | ||
| 37 | + | func TestGenerateCSS_OmniboxHeaderBadgeSelectorsExist(t *testing.T) { | |
| 38 | + | css := GenerateCSS(DefaultDarkPalette()) | |
| 39 | + | ||
| 40 | + | if !strings.Contains(css, ".omnibox-header-badge {") { | |
| 41 | + | t.Fatalf("expected omnibox header badge selector in CSS") | |
| 42 | + | } | |
| 43 | + | if !strings.Contains(css, ".omnibox-header-badge:hover {") { | |
| 44 | + | t.Fatalf("expected omnibox header badge hover selector in CSS") | |
| 45 | + | } | |
| 46 | + | } | |
| 47 | + | ||
| 48 | + | func TestGenerateCSS_OmniboxHeaderBadgeUsesPassiveNeutralChipStyling(t *testing.T) { | |
| 49 | + | css := GenerateCSS(DefaultDarkPalette()) | |
| 50 | + | ||
| 51 | + | badgeRe := regexp.MustCompile(`(?s)\.omnibox-header-badge\s*\{[^}]*background-color:\s*alpha\(var\(--surface-variant\),\s*0\.65\);[^}]*color:\s*var\(--muted\);[^}]*border:\s*0\.0625em solid alpha\(var\(--border\),\s*0\.85\);[^}]*border-radius:\s*0\.1875em;[^}]*padding:\s*0\.0625em 0\.375em;[^}]*font-size:\s*0\.6875em;`) | |
| 52 | + | if !badgeRe.MatchString(css) { | |
| 53 | + | t.Fatalf("expected omnibox header badge to use passive neutral chip styling") | |
| 54 | + | } | |
| 55 | + | ||
| 56 | + | hoverRe := regexp.MustCompile(`(?s)\.omnibox-header-badge:hover\s*\{[^}]*background-color:\s*shade\(var\(--surface-variant\),\s*1\.08\);[^}]*border-color:\s*var\(--border\);[^}]*color:\s*var\(--text\);`) | |
| 57 | + | if !hoverRe.MatchString(css) { | |
| 58 | + | t.Fatalf("expected omnibox header badge hover styling to stay neutral while hinting interactivity") | |
| 59 | + | } | |
| 60 | + | ||
| 61 | + | if strings.Contains(css, ".omnibox-header-badge {\n\tbackground-color: alpha(var(--accent),") { | |
| 62 | + | t.Fatalf("expected omnibox header badge resting state to avoid accent-based styling") | |
| 63 | + | } | |
| 64 | + | if strings.Contains(css, ".omnibox-header-badge {\n\tcolor: var(--accent);") { | |
| 65 | + | t.Fatalf("expected omnibox header badge resting text to avoid accent color") | |
| 66 | + | } | |
| 67 | + | } | |
| 68 | + | ||
| 37 | 69 | func TestGenerateCSS_FavoriteRowsOnlyTintTrailingAffordance(t *testing.T) { | |
| 38 | 70 | css := GenerateCSS(DefaultDarkPalette()) | |
| 39 | 71 | ||
| @@ -34,6 +34,38 @@ func TestGenerateCSS_OmniboxHeaderIsOpaque(t *testing.T) { | |||||
| 34 | } | 34 | } | ||
| 35 | } | 35 | } | ||
| 36 | 36 | ||||
| 37 | + | func TestGenerateCSS_OmniboxHeaderBadgeSelectorsExist(t *testing.T) { | |||
| 38 | + | css := GenerateCSS(DefaultDarkPalette()) | |||
| 39 | + | ||||
| 40 | + | if !strings.Contains(css, ".omnibox-header-badge {") { | |||
| 41 | + | t.Fatalf("expected omnibox header badge selector in CSS") | |||
| 42 | + | } | |||
| 43 | + | if !strings.Contains(css, ".omnibox-header-badge:hover {") { | |||
| 44 | + | t.Fatalf("expected omnibox header badge hover selector in CSS") | |||
| 45 | + | } | |||
| 46 | + | } | |||
| 47 | + | ||||
| 48 | + | func TestGenerateCSS_OmniboxHeaderBadgeUsesPassiveNeutralChipStyling(t *testing.T) { | |||
| 49 | + | css := GenerateCSS(DefaultDarkPalette()) | |||
| 50 | + | ||||
| 51 | + | badgeRe := regexp.MustCompile(`(?s)\.omnibox-header-badge\s*\{[^}]*background-color:\s*alpha\(var\(--surface-variant\),\s*0\.65\);[^}]*color:\s*var\(--muted\);[^}]*border:\s*0\.0625em solid alpha\(var\(--border\),\s*0\.85\);[^}]*border-radius:\s*0\.1875em;[^}]*padding:\s*0\.0625em 0\.375em;[^}]*font-size:\s*0\.6875em;`) | |||
| 52 | + | if !badgeRe.MatchString(css) { | |||
| 53 | + | t.Fatalf("expected omnibox header badge to use passive neutral chip styling") | |||
| 54 | + | } | |||
| 55 | + | ||||
| 56 | + | hoverRe := regexp.MustCompile(`(?s)\.omnibox-header-badge:hover\s*\{[^}]*background-color:\s*shade\(var\(--surface-variant\),\s*1\.08\);[^}]*border-color:\s*var\(--border\);[^}]*color:\s*var\(--text\);`) | |||
| 57 | + | if !hoverRe.MatchString(css) { | |||
| 58 | + | t.Fatalf("expected omnibox header badge hover styling to stay neutral while hinting interactivity") | |||
| 59 | + | } | |||
| 60 | + | ||||
| 61 | + | if strings.Contains(css, ".omnibox-header-badge {\n\tbackground-color: alpha(var(--accent),") { | |||
| 62 | + | t.Fatalf("expected omnibox header badge resting state to avoid accent-based styling") | |||
| 63 | + | } | |||
| 64 | + | if strings.Contains(css, ".omnibox-header-badge {\n\tcolor: var(--accent);") { | |||
| 65 | + | t.Fatalf("expected omnibox header badge resting text to avoid accent color") | |||
| 66 | + | } | |||
| 67 | + | } | |||
| 68 | + | ||||
| 37 | func TestGenerateCSS_FavoriteRowsOnlyTintTrailingAffordance(t *testing.T) { | 69 | func TestGenerateCSS_FavoriteRowsOnlyTintTrailingAffordance(t *testing.T) { | ||
| 38 | css := GenerateCSS(DefaultDarkPalette()) | 70 | css := GenerateCSS(DefaultDarkPalette()) | ||
| 39 | 71 | ||||