fix: MPS-24 — systemic dark-mode token sweep (close the whole bug class)
After fixing the same dark-mode bug 4x one surface at a time, swept it system-wide. Root pattern: var(--name, fallback) where --name is NOT a token in tokens.css -> the light fallback applied in BOTH themes -> dark broken. Offenders: --color-surface*, --color-border*, --color-text*, --text-color, --surface* (none are tokens). - Remapped all 53 occurrences in common.css to the real theme-aware tokens (--surface-base/-dim/-container, --border-default, --text-primary/-body/-muted), KEEPING each fallback literal (comma-boundary sed). Diff verified: exactly 53/53 var-name-only swaps, no fallback/structure change, line count unchanged. - Light mode: identical where token==fallback (#fff, off-whites); minor canonical nudges where they differ (muted #888->#666, body #333->#515151, primary #111->#333, borders ->#e0e0e0) — the design system's intended values, the 'light looks better' direction. - Dark mode fixed app-wide (wells, suggest cards, counts, checksum table, and every other surface using these vars). - Excluded (not the bug): --shop-theme-*, --color-accent, --pico-*, --primary-color, the --dark-* family, theme-neutral font/size vars. - CLAUDE.md: DARK-MODE TRAP rule + pre-commit grep gate. mps-24.md Phase 2.8r. 1151 passed (CSS-only).
This commit is contained in:
parent
b39efcad4e
commit
64bc435a00
3 changed files with 79 additions and 53 deletions
|
|
@ -290,6 +290,11 @@ Note: `align-items`, `justify-items`, `align-content`, `justify-content`, `place
|
|||
|
||||
**DESIGN TOKENS**: All new styles must consume tokens from `tokens.css` — never hardcode colors, spacing, radii, shadows, or font sizes. Use `var(--token-name)` or `var(--token-name, fallback)`. Our token scale uses a 4px spacing base and major third (1.250) type scale.
|
||||
|
||||
**DARK-MODE TRAP — only reference vars that are REAL tokens.** A `var(--name, fallback)` where `--name` is **not** defined in `tokens.css` silently uses the light `fallback` in BOTH themes → looks fine in light, broken (light card / invisible text) in dark. This bit us repeatedly (wells, suggest cards, checksum table). The offenders were ad-hoc names like `--color-surface*`, `--color-border*`, `--color-text*`, `--text-color`, `--surface*` — none are tokens. **Use the real theme-aware tokens**: surfaces → `--surface-base` / `--surface-dim` / `--surface-container`; borders → `--border-light` / `--border-default` / `--border-color`; text → `--text-primary` / `--text-body` / `--text-muted` (all carry `:root` + `[data-theme="dark"]` values). Pre-commit grep gate (must be empty):
|
||||
```
|
||||
grep -oE 'var\(\s*--(color-(surface|border|text)[a-z0-9-]*|surface(-[a-z]+)?|text-color)\s*,' make_post_sell/static/css/common.css
|
||||
```
|
||||
|
||||
**STYLEGUIDE**: When creating new UI components (buttons, wells, alerts, layout patterns, etc.), add a live example to `/styleguide` (`make_post_sell/templates/styleguide.j2`). Our styleguide is our single source of truth for our component library. If it's not in our styleguide, it doesn't exist as a pattern.
|
||||
|
||||
**CSS MEDIA SIZING**: Never combine `width: 100%` with `max-height` on media elements (img, video). `width: 100%` forces our element to span our full container even when `max-height` constrains our rendered content, creating dead whitespace. Use `width: auto` + `max-width: 100%` + `max-height` instead — our element shrinks to match our actual content aspect ratio within both constraints.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue