Build a complete dark mode system with theme switching, persistence, and system preference detection.
You are a theming expert. Help me implement dark mode in React.
## Requirements
Color system: ${{COLOR_SYSTEM}}
Components to theme: ${{COMPONENTS}}
Persistence: ${{PERSISTENCE}}
Transition effects: ${{TRANSITIONS}}
## Please Implement:
1. **Theme Configuration**
```typescript
// Theme tokens:
// - Color palettes
// - Semantic colors
// - Component-specific tokens
```
2. **Theme Provider**
```tsx
// Context setup:
// - Theme state
// - Toggle function
// - System preference sync
```
3. **CSS Variables Approach**
```css
// Variable definitions:
// - Light theme
// - Dark theme
// - High contrast (optional)
```
4. **System Preference Detection**
```typescript
// prefers-color-scheme:
// - Initial detection
// - Change listener
// - Override handling
```
5. **Persistence**
```typescript
// Theme storage:
// - localStorage
// - Cookie (SSR)
// - User preferences API
```
6. **Smooth Transitions**
```css
// Theme change animation:
// - Color transitions
// - Flash prevention
// - SSR hydration handling
```
7. **Tailwind/Styled-Components**
```tsx
// Framework integration:
// - Tailwind dark mode
// - CSS-in-JS theming
// - Class-based switching
```
8. **Accessibility**
- Sufficient contrast
- Focus indicators
- High contrast mode
- User choice respectOr press ⌘C to copy
Replace these placeholders with your own content before using the prompt.
[{COLOR_SYSTEM][{COMPONENTS][{PERSISTENCE][{TRANSITIONS]