1.9 KiB
1.9 KiB
Quickstart: Semantic Hover Tokens
What This Feature Does
Replaces hardcoded hover colors across UI components with three semantic CSS custom properties (tokens), so all hover colors can be changed from one place in the theme.
Key Files
- Theme:
apps/web/src/index.css— define the six new--color-hover-*tokens in the@themeblock - Components to update:
apps/web/src/components/combatant-row.tsx— 6× neutral, 1× destructiveapps/web/src/components/condition-tags.tsx— neutral text + bgapps/web/src/components/condition-picker.tsx— neutral bgapps/web/src/components/turn-navigation.tsx— 2× action, 1× destructiveapps/web/src/components/action-bar.tsx— neutral bgapps/web/src/components/stat-block-panel.tsx— neutral text (close button)apps/web/src/components/bestiary-search.tsx— neutral text + bgapps/web/src/components/ui/button.tsx— outline + ghost variant hovers
Token → Tailwind Class Mapping
| Token | Tailwind Text Class | Tailwind BG Class |
|---|---|---|
--color-hover-neutral |
hover:text-hover-neutral |
— |
--color-hover-action |
hover:text-hover-action |
— |
--color-hover-destructive |
hover:text-hover-destructive |
— |
--color-hover-neutral-bg |
— | hover:bg-hover-neutral-bg |
--color-hover-action-bg |
— | hover:bg-hover-action-bg |
--color-hover-destructive-bg |
— | hover:bg-hover-destructive-bg |
How to Verify
pnpm --filter web dev— start dev server- Hover over editable fields (name, HP, AC, initiative) → should turn blue (primary)
- Hover over navigation buttons (prev/next, Roll All) → should be blue
- Hover over remove/clear buttons → should be red
- Change
--color-hover-neutralto a bright color in DevTools → all editable fields should update