import { Meta, ColorPalette, ColorItem } from 'storybook/blocks';
# Color System
Our color system provides semantic colors for consistent visual language across the application.
## Color Principles
1. **Meaningful Usage**: Colors communicate meaning - use them consistently
2. **Accessibility First**: All color combinations meet WCAG 2.1 AA contrast ratios
3. **Dark Mode Support**: Every color has light and dark mode variants
4. **Semantic Naming**: Use semantic names (`primary`, `error`) not raw values
## Primary Colors
Primary colors represent the brand and are used for key actions, links, and emphasis.
### Usage
- **Primary 600**: Default button backgrounds, links
- **Primary 700**: Hover states
- **Primary 500**: Focus rings, light accents
- **Primary 100-200**: Backgrounds for selected items
```tsx
// Primary button
// Primary text link
Learn more
```
## Semantic Colors
### Success Colors
Used for positive feedback, confirmations, and successful states.
### Error Colors
Used for errors, destructive actions, and critical warnings.
### Warning Colors
Used for caution states and important notices.
## Neutral Colors
Neutrals form the foundation of the interface - backgrounds, text, borders.
### Text Colors
| Usage | Light Mode | Dark Mode |
|-------|-----------|-----------|
| Primary text | `neutral-900` | `neutral-100` |
| Secondary text | `neutral-600` | `neutral-400` |
| Disabled text | `neutral-400` | `neutral-600` |
| Placeholder | `neutral-500` | `neutral-400` |
### Background Colors
| Usage | Light Mode | Dark Mode |
|-------|-----------|-----------|
| Page background | `white` | `neutral-900` |
| Card background | `white` | `neutral-800` |
| Hover state | `neutral-100` | `neutral-800` |
| Disabled | `neutral-100` | `neutral-900` |
### Border Colors
| Usage | Light Mode | Dark Mode |
|-------|-----------|-----------|
| Default | `neutral-200` | `neutral-700` |
| Strong | `neutral-300` | `neutral-600` |
| Subtle | `neutral-100` | `neutral-800` |
## Color Accessibility
All color combinations are tested against WCAG 2.1 guidelines:
- **AA Standard (4.5:1)**: Normal text on backgrounds
- **AA Large (3:1)**: Large text (18px+) and UI components
- **AAA Standard (7:1)**: Enhanced contrast for better readability
### Tested Combinations
| Foreground | Background | Ratio | Level |
|------------|------------|-------|-------|
| `neutral-900` | `white` | 17.4:1 | AAA |
| `neutral-700` | `white` | 8.5:1 | AAA |
| `primary-600` | `white` | 4.6:1 | AA |
| `error-600` | `white` | 4.5:1 | AA |
| `success-700` | `white` | 4.7:1 | AA |
## Dark Mode
All semantic colors automatically adjust in dark mode:
```tsx
// Automatic dark mode support
Text adapts to theme
```
### Dark Mode Adjustments
1. **Backgrounds**: Shift from light (`white`) to dark (`neutral-800/900`)
2. **Text**: Shift from dark (`neutral-900`) to light (`neutral-100`)
3. **Borders**: Shift from light (`neutral-200`) to dark (`neutral-700`)
4. **Accents**: Use lighter shade variants (e.g., `primary-400` instead of `primary-600`)
## Usage Guidelines
### Do
- Use semantic color names (`bg-primary-600`) not hex values
- Ensure sufficient contrast for all text
- Test all color combinations in both light and dark modes
- Use opacity for subtle variations (`bg-black/50`)
### Don't
- Use hardcoded hex values in components
- Create custom colors outside the system
- Use colors that don't meet accessibility standards
- Forget to test dark mode variants