Skip to content

Conversation

@Gaubee
Copy link
Contributor

@Gaubee Gaubee commented Dec 26, 2025

Summary

Add comprehensive dark mode support with automated lint checks and fixes.

Changes

Lint Script (scripts/theme-check.ts)

  • no-bg-as-text: Prevents using background colors as text colors
  • text-white-on-semantic-bg: Detects text-white on bg-primary/destructive
  • orphan-foreground: Foreground colors without matching background
  • bg-muted-no-text-color: bg-muted without explicit text color
  • missing-dark-variant: Hardcoded gray colors without dark: variant

Fixes

  • Replace text-white with semantic foreground colors in 15+ files
  • Override stackflow plugin colors for dark mode (AppScreen, BottomSheet, Modal)
  • Change wallet pages to use bg-background instead of semi-transparent bg-muted/30

Documentation

  • Created docs/white-book/02-设计篇/02-视觉设计/dark-mode.md
  • Updated docs/white-book/00-必读/best-practices.md

CI Integration

  • Added theme:check and theme:run scripts
  • Integrated into turbo.json and CI workflow

Testing

  • All tests pass (1477 tests)
  • Typecheck passes
  • Theme check: 0 errors, 5 warnings (acceptable edge cases)

- Add scripts/theme-check.ts to validate dark mode usage
- Add docs/white-book/02-设计篇/02-视觉设计/dark-mode.md
- Update best-practices.md with dark mode rules
- Add theme:check and theme:run scripts to package.json
- Add theme:run task to turbo.json
- Integrate theme:run into CI workflow

Rules implemented:
- no-bg-as-text: Prevent using background colors as text colors
- orphan-foreground: Warn when foreground colors lack matching background
- missing-dark-variant: Warn when hardcoded colors lack dark: variants
Add two new lint rules:
- text-white-on-semantic-bg: Detect text-white on bg-primary/destructive
- bg-muted-no-text-color: Detect bg-muted without explicit text color

Update documentation with new rules and examples.

Current detection: 19 errors, 30 warnings
Fix 19 dark mode errors by replacing text-white with text-xxx-foreground:
- bg-primary text-white -> bg-primary text-primary-foreground
- bg-destructive text-white -> bg-destructive text-destructive-foreground
- bg-muted -> bg-muted text-muted-foreground (where needed)

Also improve theme-check.ts to reduce false positives:
- Skip hover/focus/active-only bg-muted patterns
- Skip peer/group conditional foreground styles
- Expand context range for better detection

Files modified:
- 15 component/page files with dark mode fixes
- scripts/theme-check.ts with improved detection

Result: 0 errors, 5 warnings (down from 19 errors, 30 warnings)
The stackflow basicUIPlugin with cupertino theme has hardcoded white backgrounds
using vanilla-extract generated classes. Added CSS overrides targeting stable
data-stackflow-* attributes to use our theme colors.

Changes:
- Override stackflow CSS variables for dark mode using data attributes
- Force background-color on activity containers
- Changed wallet/list and settings/wallet-chains to use bg-background
@Gaubee Gaubee merged commit 8a667c0 into main Dec 26, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants