@champpaba/claude-agent-kit 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +561 -0
- package/bin/cli.js +61 -0
- package/lib/init.js +52 -0
- package/lib/update.js +73 -0
- package/package.json +47 -0
- package/template/.claude/CHANGELOG-v1.1.1.md +259 -0
- package/template/.claude/CLAUDE.md +329 -0
- package/template/.claude/agents/01-integration.md +797 -0
- package/template/.claude/agents/02-uxui-frontend.md +899 -0
- package/template/.claude/agents/03-test-debug.md +759 -0
- package/template/.claude/agents/04-frontend.md +1099 -0
- package/template/.claude/agents/05-backend.md +1217 -0
- package/template/.claude/agents/06-database.md +969 -0
- package/template/.claude/commands/agentsetup.md +1464 -0
- package/template/.claude/commands/cdev.md +327 -0
- package/template/.claude/commands/csetup.md +447 -0
- package/template/.claude/commands/cstatus.md +60 -0
- package/template/.claude/commands/cview.md +364 -0
- package/template/.claude/commands/psetup.md +101 -0
- package/template/.claude/contexts/design/accessibility.md +611 -0
- package/template/.claude/contexts/design/box-thinking.md +553 -0
- package/template/.claude/contexts/design/color-theory.md +498 -0
- package/template/.claude/contexts/design/index.md +247 -0
- package/template/.claude/contexts/design/layout.md +400 -0
- package/template/.claude/contexts/design/responsive.md +551 -0
- package/template/.claude/contexts/design/shadows.md +522 -0
- package/template/.claude/contexts/design/spacing.md +428 -0
- package/template/.claude/contexts/design/typography.md +465 -0
- package/template/.claude/contexts/domain/README.md +164 -0
- package/template/.claude/contexts/patterns/agent-coordination.md +388 -0
- package/template/.claude/contexts/patterns/agent-discovery.md +182 -0
- package/template/.claude/contexts/patterns/change-workflow.md +538 -0
- package/template/.claude/contexts/patterns/code-standards.md +515 -0
- package/template/.claude/contexts/patterns/development-principles.md +513 -0
- package/template/.claude/contexts/patterns/error-handling.md +478 -0
- package/template/.claude/contexts/patterns/error-recovery.md +365 -0
- package/template/.claude/contexts/patterns/frontend-component-strategy.md +365 -0
- package/template/.claude/contexts/patterns/git-workflow.md +207 -0
- package/template/.claude/contexts/patterns/logging.md +424 -0
- package/template/.claude/contexts/patterns/task-breakdown.md +452 -0
- package/template/.claude/contexts/patterns/task-classification.md +523 -0
- package/template/.claude/contexts/patterns/tdd-classification.md +516 -0
- package/template/.claude/contexts/patterns/testing.md +413 -0
- package/template/.claude/contexts/patterns/ui-component-consistency.md +304 -0
- package/template/.claude/contexts/patterns/validation-framework.md +776 -0
- package/template/.claude/lib/README.md +39 -0
- package/template/.claude/lib/agent-executor.md +258 -0
- package/template/.claude/lib/agent-router.md +572 -0
- package/template/.claude/lib/flags-updater.md +469 -0
- package/template/.claude/lib/tdd-classifier.md +345 -0
- package/template/.claude/lib/validation-gates.md +484 -0
- package/template/.claude/settings.local.json +42 -0
- package/template/.claude/templates/context-template.md +45 -0
- package/template/.claude/templates/flags-template.json +42 -0
- package/template/.claude/templates/phase-templates.json +124 -0
- package/template/.claude/templates/phases-sections/accessibility-test.md +17 -0
- package/template/.claude/templates/phases-sections/api-design.md +37 -0
- package/template/.claude/templates/phases-sections/backend-tests.md +16 -0
- package/template/.claude/templates/phases-sections/backend.md +37 -0
- package/template/.claude/templates/phases-sections/business-logic-validation.md +16 -0
- package/template/.claude/templates/phases-sections/component-tests.md +17 -0
- package/template/.claude/templates/phases-sections/contract-backend.md +16 -0
- package/template/.claude/templates/phases-sections/contract-frontend.md +16 -0
- package/template/.claude/templates/phases-sections/database.md +35 -0
- package/template/.claude/templates/phases-sections/documentation.md +17 -0
- package/template/.claude/templates/phases-sections/e2e-tests.md +16 -0
- package/template/.claude/templates/phases-sections/fix-implementation.md +17 -0
- package/template/.claude/templates/phases-sections/frontend-integration.md +18 -0
- package/template/.claude/templates/phases-sections/frontend-mockup.md +123 -0
- package/template/.claude/templates/phases-sections/manual-flow-test.md +15 -0
- package/template/.claude/templates/phases-sections/manual-ux-test.md +16 -0
- package/template/.claude/templates/phases-sections/refactor-implementation.md +17 -0
- package/template/.claude/templates/phases-sections/refactor.md +16 -0
- package/template/.claude/templates/phases-sections/regression-tests.md +15 -0
- package/template/.claude/templates/phases-sections/report.md +16 -0
- package/template/.claude/templates/phases-sections/responsive-test.md +16 -0
- package/template/.claude/templates/phases-sections/script-implementation.md +43 -0
- package/template/.claude/templates/phases-sections/test-coverage.md +16 -0
- package/template/.claude/templates/phases-sections/user-approval.md +14 -0
|
@@ -0,0 +1,498 @@
|
|
|
1
|
+
# Color Theory - Complete Professional Guide
|
|
2
|
+
|
|
3
|
+
> **Purpose:** Universal color system principles for any project
|
|
4
|
+
> **Audience:** Designers, developers, design system maintainers
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Table of Contents
|
|
9
|
+
|
|
10
|
+
1. [Color Palette Structure](#color-palette-structure)
|
|
11
|
+
2. [The 60-30-10 Rule](#the-60-30-10-rule)
|
|
12
|
+
3. [Shade Generation](#shade-generation)
|
|
13
|
+
4. [Color Harmony](#color-harmony)
|
|
14
|
+
5. [Accessibility](#accessibility)
|
|
15
|
+
6. [Implementation Patterns](#implementation-patterns)
|
|
16
|
+
7. [Best Practices](#best-practices)
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Color Palette Structure
|
|
21
|
+
|
|
22
|
+
### 1. Primary Color (30% of interface)
|
|
23
|
+
|
|
24
|
+
**Definition & Psychology:**
|
|
25
|
+
- The most prominent brand color (NOT the most-used)
|
|
26
|
+
- Creates visual emphasis and brand recognition
|
|
27
|
+
- Typically 1-2 colors maximum
|
|
28
|
+
|
|
29
|
+
**Common Psychology:**
|
|
30
|
+
| Color | Conveys |
|
|
31
|
+
|-------|---------|
|
|
32
|
+
| Blue | Trust, professionalism, calm, authority |
|
|
33
|
+
| Green | Growth, health, eco-friendly, success |
|
|
34
|
+
| Red | Energy, urgency, passion, excitement |
|
|
35
|
+
| Purple | Luxury, creativity, premium, wisdom |
|
|
36
|
+
| Orange | Friendly, cheerful, affordable, playful |
|
|
37
|
+
| Yellow | Optimism, attention, caution, warmth |
|
|
38
|
+
|
|
39
|
+
**Usage Guidelines:**
|
|
40
|
+
- ✅ Headers, navigation bars
|
|
41
|
+
- ✅ Primary action buttons
|
|
42
|
+
- ✅ Active navigation states
|
|
43
|
+
- ✅ Progress indicators
|
|
44
|
+
- ✅ Links in body text
|
|
45
|
+
- ❌ Large background areas (use neutrals)
|
|
46
|
+
- ❌ Body text (low contrast)
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
### 2. Secondary/Accent Color (10% of interface)
|
|
51
|
+
|
|
52
|
+
**Definition:**
|
|
53
|
+
- Harmonious color derived from color wheel relationships
|
|
54
|
+
- Complements primary color (warm vs cool balance)
|
|
55
|
+
- Used sparingly for emphasis
|
|
56
|
+
|
|
57
|
+
**Deriving from Primary:**
|
|
58
|
+
| Primary | Suggested Secondary |
|
|
59
|
+
|---------|-------------------|
|
|
60
|
+
| Blue | Orange, Gold, Coral |
|
|
61
|
+
| Green | Red, Pink, Purple |
|
|
62
|
+
| Red | Green, Teal, Blue-Green |
|
|
63
|
+
| Purple | Yellow, Gold, Lime |
|
|
64
|
+
|
|
65
|
+
**Usage Guidelines:**
|
|
66
|
+
- ✅ Call-to-action buttons (Start, Begin, Continue)
|
|
67
|
+
- ✅ Important highlights
|
|
68
|
+
- ✅ Premium feature badges
|
|
69
|
+
- ✅ Success states
|
|
70
|
+
- ✅ Hover states for special actions
|
|
71
|
+
- ❌ Overuse (should be rare, 10% rule)
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
### 3. Neutral Colors (60% of interface)
|
|
76
|
+
|
|
77
|
+
**Definition:**
|
|
78
|
+
- Whites, grays, blacks in 8-10 shades
|
|
79
|
+
- Foundation for text, backgrounds, borders
|
|
80
|
+
- Most screens are primarily composed of these colors
|
|
81
|
+
|
|
82
|
+
**Standard Gray Scale:**
|
|
83
|
+
```css
|
|
84
|
+
/* Backgrounds */
|
|
85
|
+
gray-50: rgb(249, 250, 251) /* Lightest backgrounds, hover states */
|
|
86
|
+
gray-100: rgb(243, 244, 246) /* Page backgrounds */
|
|
87
|
+
gray-200: rgb(229, 231, 235) /* Card backgrounds, subtle borders */
|
|
88
|
+
gray-300: rgb(209, 213, 219) /* Borders, dividers */
|
|
89
|
+
gray-400: rgb(156, 163, 175) /* Disabled states, placeholders */
|
|
90
|
+
|
|
91
|
+
/* Text */
|
|
92
|
+
gray-500: rgb(107, 114, 128) /* Muted text, secondary labels */
|
|
93
|
+
gray-600: rgb(75, 85, 99) /* Body text (dark mode) */
|
|
94
|
+
gray-700: rgb(55, 65, 81) /* Body text (light mode) */
|
|
95
|
+
gray-800: rgb(31, 41, 55) /* Headings, important text */
|
|
96
|
+
gray-900: rgb(17, 24, 39) /* Primary headings, emphasis */
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
**Usage Map:**
|
|
100
|
+
| Shade | Use Case | Example |
|
|
101
|
+
|-------|----------|---------|
|
|
102
|
+
| 50-100 | Page backgrounds, hover states | `bg-gray-50` |
|
|
103
|
+
| 200-300 | Card backgrounds, borders | `bg-gray-200 border-gray-300` |
|
|
104
|
+
| 400-500 | Disabled states, placeholders | `text-gray-400` |
|
|
105
|
+
| 600-700 | Body text, secondary headings | `text-gray-700` |
|
|
106
|
+
| 800-900 | Primary headings, important text | `text-gray-900` |
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
### 4. Semantic Colors (Status communication)
|
|
111
|
+
|
|
112
|
+
**Definition:**
|
|
113
|
+
- Colors with universal meaning for user feedback
|
|
114
|
+
- Must be consistent across all interfaces
|
|
115
|
+
- Should pass WCAG contrast ratios
|
|
116
|
+
|
|
117
|
+
**Standard Semantic Palette:**
|
|
118
|
+
|
|
119
|
+
```css
|
|
120
|
+
/* Success (Green) */
|
|
121
|
+
--success-50: rgb(240, 253, 244) /* Backgrounds */
|
|
122
|
+
--success-500: rgb(34, 197, 94) /* Base color */
|
|
123
|
+
--success-700: rgb(21, 128, 61) /* Text on light backgrounds */
|
|
124
|
+
|
|
125
|
+
/* Warning (Amber) */
|
|
126
|
+
--warning-50: rgb(255, 251, 235) /* Backgrounds */
|
|
127
|
+
--warning-500: rgb(245, 158, 11) /* Base color */
|
|
128
|
+
--warning-700: rgb(180, 83, 9) /* Text */
|
|
129
|
+
|
|
130
|
+
/* Info (Blue) */
|
|
131
|
+
--info-50: rgb(239, 246, 255) /* Backgrounds */
|
|
132
|
+
--info-500: rgb(59, 130, 246) /* Base color */
|
|
133
|
+
--info-700: rgb(29, 78, 216) /* Text */
|
|
134
|
+
|
|
135
|
+
/* Error/Destructive (Red) */
|
|
136
|
+
--error-50: rgb(254, 242, 242) /* Backgrounds */
|
|
137
|
+
--error-500: rgb(239, 68, 68) /* Base color */
|
|
138
|
+
--error-700: rgb(185, 28, 28) /* Text */
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
**Usage Rules:**
|
|
142
|
+
| Color | Meaning | Use Cases | Don't Use For |
|
|
143
|
+
|-------|---------|-----------|---------------|
|
|
144
|
+
| Green | Success, Positive | Confirmations, completed states, "saved" | Money (use semantic context), navigation |
|
|
145
|
+
| Amber | Warning, Caution | Alerts requiring attention, non-critical warnings | Errors (use red), highlights |
|
|
146
|
+
| Blue | Info, Neutral | Informational messages, tips, helper text | Primary actions, links |
|
|
147
|
+
| Red | Error, Destructive | Failed states, validation errors, delete confirmations | Emphasis, required fields |
|
|
148
|
+
|
|
149
|
+
**Critical Rule:**
|
|
150
|
+
- Use **true red** for errors UNLESS red is your primary color
|
|
151
|
+
- If red is primary, use **orange** (`#F97316`) for errors instead
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## The 60-30-10 Rule
|
|
156
|
+
|
|
157
|
+
### Visual Balance Formula
|
|
158
|
+
|
|
159
|
+
**Rule Definition:**
|
|
160
|
+
- **60%** Dominant color (Neutrals - backgrounds, text)
|
|
161
|
+
- **30%** Secondary color (Primary brand color - headers, actions)
|
|
162
|
+
- **10%** Accent color (Secondary brand + semantic colors)
|
|
163
|
+
|
|
164
|
+
### Why This Works
|
|
165
|
+
|
|
166
|
+
**Psychological Basis:**
|
|
167
|
+
- **60%**: Creates visual calm and foundation
|
|
168
|
+
- **30%**: Establishes brand identity without overwhelming
|
|
169
|
+
- **10%**: Draws attention to important elements
|
|
170
|
+
|
|
171
|
+
**Example Application:**
|
|
172
|
+
|
|
173
|
+
```
|
|
174
|
+
Landing Page:
|
|
175
|
+
├─ 60% White background, gray text (Neutrals)
|
|
176
|
+
├─ 30% Blue headers, navigation, primary buttons (Primary)
|
|
177
|
+
└─ 10% Orange CTAs, gold badges, green success (Accent)
|
|
178
|
+
|
|
179
|
+
Dashboard:
|
|
180
|
+
├─ 60% Light gray backgrounds, dark text (Neutrals)
|
|
181
|
+
├─ 30% Purple sidebar, active states (Primary)
|
|
182
|
+
└─ 10% Yellow highlights, red errors (Accent)
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### Common Mistakes
|
|
186
|
+
|
|
187
|
+
**❌ Wrong:**
|
|
188
|
+
```css
|
|
189
|
+
/* Too much accent color (50% primary, 50% accent) */
|
|
190
|
+
background: linear-gradient(blue, orange);
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
**✅ Correct:**
|
|
194
|
+
```css
|
|
195
|
+
/* Proper balance (60% neutral, 30% primary, 10% accent) */
|
|
196
|
+
body { background: white; } /* 60% */
|
|
197
|
+
header { background: blue; } /* 30% */
|
|
198
|
+
.cta { background: orange; } /* 10% */
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
## Shade Generation
|
|
204
|
+
|
|
205
|
+
### 9-Shade Scale (Industry Standard)
|
|
206
|
+
|
|
207
|
+
**Naming Convention:**
|
|
208
|
+
- 50, 100, 200, 300, 400, 500, 600, 700, 800, 900
|
|
209
|
+
- 500 = Base color
|
|
210
|
+
- Lower numbers = Lighter (toward white)
|
|
211
|
+
- Higher numbers = Darker (toward black)
|
|
212
|
+
|
|
213
|
+
### Generation Methods
|
|
214
|
+
|
|
215
|
+
**Method 1: HSL Manipulation (Recommended)**
|
|
216
|
+
|
|
217
|
+
```javascript
|
|
218
|
+
// Starting with base color (500)
|
|
219
|
+
const base = { h: 220, s: 70%, l: 50% }; // Blue
|
|
220
|
+
|
|
221
|
+
// Lightness scale
|
|
222
|
+
const shades = {
|
|
223
|
+
50: { ...base, l: 95% }, // Lightest
|
|
224
|
+
100: { ...base, l: 90% },
|
|
225
|
+
200: { ...base, l: 80% },
|
|
226
|
+
300: { ...base, l: 70% },
|
|
227
|
+
400: { ...base, l: 60% },
|
|
228
|
+
500: { ...base, l: 50% }, // Base
|
|
229
|
+
600: { ...base, l: 40% },
|
|
230
|
+
700: { ...base, l: 30% },
|
|
231
|
+
800: { ...base, l: 20% },
|
|
232
|
+
900: { ...base, l: 10% } // Darkest
|
|
233
|
+
};
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
**Method 2: Online Tools**
|
|
237
|
+
- **Tailwind Shades Generator**: https://www.tints.dev/
|
|
238
|
+
- **Coolors Palette**: https://coolors.co/
|
|
239
|
+
- **Adobe Color**: https://color.adobe.com/
|
|
240
|
+
|
|
241
|
+
**Usage Rules:**
|
|
242
|
+
| Shade | Background | Text | Borders |
|
|
243
|
+
|-------|------------|------|---------|
|
|
244
|
+
| 50-100 | ✅ Light backgrounds | ❌ Too light | ❌ Too faint |
|
|
245
|
+
| 200-300 | ✅ Cards, hover states | ❌ Low contrast | ✅ Subtle borders |
|
|
246
|
+
| 400-500 | ✅ Buttons, badges | ✅ On white background | ✅ Default borders |
|
|
247
|
+
| 600-700 | ⚠️ Dark backgrounds | ✅ Body text | ⚠️ Too heavy |
|
|
248
|
+
| 800-900 | ⚠️ Very dark backgrounds | ✅ Headings | ❌ Too dark |
|
|
249
|
+
|
|
250
|
+
---
|
|
251
|
+
|
|
252
|
+
## Color Harmony
|
|
253
|
+
|
|
254
|
+
### 1. Monochromatic (Safest)
|
|
255
|
+
|
|
256
|
+
**Definition:** Variations of a single hue (different lightness/saturation)
|
|
257
|
+
|
|
258
|
+
**Example:**
|
|
259
|
+
```css
|
|
260
|
+
Primary: Blue (H: 220)
|
|
261
|
+
├─ Light blue: hsl(220, 70%, 80%)
|
|
262
|
+
├─ Base blue: hsl(220, 70%, 50%)
|
|
263
|
+
└─ Dark blue: hsl(220, 70%, 20%)
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
**When to Use:**
|
|
267
|
+
- Minimalist designs
|
|
268
|
+
- Professional/corporate sites
|
|
269
|
+
- When starting out (easiest to get right)
|
|
270
|
+
|
|
271
|
+
**Pros/Cons:**
|
|
272
|
+
- ✅ Always harmonious
|
|
273
|
+
- ✅ Consistent mood
|
|
274
|
+
- ❌ Can be boring
|
|
275
|
+
- ❌ Limited visual interest
|
|
276
|
+
|
|
277
|
+
---
|
|
278
|
+
|
|
279
|
+
### 2. Complementary (High Contrast)
|
|
280
|
+
|
|
281
|
+
**Definition:** Opposite colors on color wheel (180° apart)
|
|
282
|
+
|
|
283
|
+
**Examples:**
|
|
284
|
+
- Blue (#0000FF) + Orange (#FFA500)
|
|
285
|
+
- Red (#FF0000) + Green (#00FF00)
|
|
286
|
+
- Purple (#800080) + Yellow (#FFFF00)
|
|
287
|
+
|
|
288
|
+
**When to Use:**
|
|
289
|
+
- CTAs that need to "pop"
|
|
290
|
+
- Attention-grabbing designs
|
|
291
|
+
- Sports brands, energetic sites
|
|
292
|
+
|
|
293
|
+
**Pros/Cons:**
|
|
294
|
+
- ✅ High visual impact
|
|
295
|
+
- ✅ Clear hierarchy
|
|
296
|
+
- ❌ Can be jarring if overused
|
|
297
|
+
- ❌ Requires careful balance (60-30-10 rule)
|
|
298
|
+
|
|
299
|
+
---
|
|
300
|
+
|
|
301
|
+
### 3. Analogous (Cohesive)
|
|
302
|
+
|
|
303
|
+
**Definition:** Adjacent colors on color wheel (30° apart)
|
|
304
|
+
|
|
305
|
+
**Examples:**
|
|
306
|
+
- Blue + Blue-Green + Green
|
|
307
|
+
- Orange + Red-Orange + Red
|
|
308
|
+
- Purple + Blue-Purple + Blue
|
|
309
|
+
|
|
310
|
+
**When to Use:**
|
|
311
|
+
- Nature-inspired designs
|
|
312
|
+
- Calm, cohesive aesthetics
|
|
313
|
+
- Gradients and subtle transitions
|
|
314
|
+
|
|
315
|
+
**Pros/Cons:**
|
|
316
|
+
- ✅ Naturally harmonious
|
|
317
|
+
- ✅ Smooth gradients
|
|
318
|
+
- ❌ Low contrast (harder to create hierarchy)
|
|
319
|
+
- ❌ Can lack "pop"
|
|
320
|
+
|
|
321
|
+
---
|
|
322
|
+
|
|
323
|
+
### 4. Triadic (Vibrant)
|
|
324
|
+
|
|
325
|
+
**Definition:** 3 colors evenly spaced on color wheel (120° apart)
|
|
326
|
+
|
|
327
|
+
**Examples:**
|
|
328
|
+
- Red + Yellow + Blue (primary colors)
|
|
329
|
+
- Orange + Green + Purple (secondary colors)
|
|
330
|
+
|
|
331
|
+
**When to Use:**
|
|
332
|
+
- Playful brands
|
|
333
|
+
- Children's products
|
|
334
|
+
- Creative portfolios
|
|
335
|
+
|
|
336
|
+
**Pros/Cons:**
|
|
337
|
+
- ✅ Vibrant and balanced
|
|
338
|
+
- ✅ Visual variety
|
|
339
|
+
- ❌ Hard to execute well
|
|
340
|
+
- ❌ Can look chaotic
|
|
341
|
+
|
|
342
|
+
---
|
|
343
|
+
|
|
344
|
+
## Accessibility
|
|
345
|
+
|
|
346
|
+
### WCAG Contrast Ratios
|
|
347
|
+
|
|
348
|
+
**Minimum Requirements:**
|
|
349
|
+
|
|
350
|
+
| Text Type | WCAG AA | WCAG AAA |
|
|
351
|
+
|-----------|---------|----------|
|
|
352
|
+
| Normal text (<18pt) | 4.5:1 | 7:1 |
|
|
353
|
+
| Large text (≥18pt or ≥14pt bold) | 3:1 | 4.5:1 |
|
|
354
|
+
| UI components (buttons, inputs) | 3:1 | N/A |
|
|
355
|
+
|
|
356
|
+
### Testing Contrast
|
|
357
|
+
|
|
358
|
+
**Tools:**
|
|
359
|
+
- **WebAIM Contrast Checker**: https://webaim.org/resources/contrastchecker/
|
|
360
|
+
- **Contrast Ratio**: https://contrast-ratio.com/
|
|
361
|
+
- **Chrome DevTools**: Lighthouse audit
|
|
362
|
+
|
|
363
|
+
**Example:**
|
|
364
|
+
```css
|
|
365
|
+
/* ✅ PASS - 7.5:1 contrast */
|
|
366
|
+
background: white; /* #FFFFFF */
|
|
367
|
+
color: black; /* #000000 */
|
|
368
|
+
|
|
369
|
+
/* ✅ PASS - 4.6:1 contrast */
|
|
370
|
+
background: blue; /* #0000FF */
|
|
371
|
+
color: white; /* #FFFFFF */
|
|
372
|
+
|
|
373
|
+
/* ❌ FAIL - 2.1:1 contrast */
|
|
374
|
+
background: gray; /* #CCCCCC */
|
|
375
|
+
color: white; /* #FFFFFF */
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
### Color Blindness Considerations
|
|
379
|
+
|
|
380
|
+
**Types:**
|
|
381
|
+
- **Protanopia** (Red-blind): 1% of men
|
|
382
|
+
- **Deuteranopia** (Green-blind): 1% of men
|
|
383
|
+
- **Tritanopia** (Blue-blind): 0.01% of population
|
|
384
|
+
- **Achromatopsia** (Total color blind): 0.003%
|
|
385
|
+
|
|
386
|
+
**Design Solutions:**
|
|
387
|
+
- ✅ Use icons + text (not just color)
|
|
388
|
+
- ✅ Use patterns/textures
|
|
389
|
+
- ✅ Ensure sufficient contrast
|
|
390
|
+
- ❌ Don't rely on red/green alone
|
|
391
|
+
- ❌ Don't use only color to convey meaning
|
|
392
|
+
|
|
393
|
+
**Testing Tools:**
|
|
394
|
+
- **Color Oracle**: Free color blindness simulator
|
|
395
|
+
- **Stark Plugin**: Figma/Sketch plugin
|
|
396
|
+
- **Chrome DevTools**: Vision deficiency emulation
|
|
397
|
+
|
|
398
|
+
---
|
|
399
|
+
|
|
400
|
+
## Implementation Patterns
|
|
401
|
+
|
|
402
|
+
### CSS Custom Properties
|
|
403
|
+
|
|
404
|
+
```css
|
|
405
|
+
/* Define in :root */
|
|
406
|
+
:root {
|
|
407
|
+
/* Primary */
|
|
408
|
+
--primary-50: rgb(236, 242, 249);
|
|
409
|
+
--primary-500: rgb(15, 42, 74);
|
|
410
|
+
--primary-900: rgb(3, 8, 15);
|
|
411
|
+
|
|
412
|
+
/* Semantic tokens */
|
|
413
|
+
--color-background: var(--neutral-50);
|
|
414
|
+
--color-text: var(--neutral-900);
|
|
415
|
+
--color-primary: var(--primary-500);
|
|
416
|
+
--color-success: var(--success-500);
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
/* Use in components */
|
|
420
|
+
.button {
|
|
421
|
+
background: var(--color-primary);
|
|
422
|
+
color: white;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
.alert-success {
|
|
426
|
+
background: var(--success-50);
|
|
427
|
+
color: var(--success-700);
|
|
428
|
+
border: 1px solid var(--success-500);
|
|
429
|
+
}
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
### Dark Mode Support
|
|
433
|
+
|
|
434
|
+
```css
|
|
435
|
+
/* Light mode (default) */
|
|
436
|
+
:root {
|
|
437
|
+
--color-background: white;
|
|
438
|
+
--color-text: rgb(17, 24, 39); /* gray-900 */
|
|
439
|
+
--color-primary: rgb(59, 130, 246); /* blue-500 */
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
/* Dark mode */
|
|
443
|
+
.dark {
|
|
444
|
+
--color-background: rgb(17, 24, 39); /* gray-900 */
|
|
445
|
+
--color-text: white;
|
|
446
|
+
--color-primary: rgb(147, 197, 253); /* blue-300 (lighter for dark backgrounds) */
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
/* Inversion Rule: */
|
|
450
|
+
/* Light primary becomes light background in dark mode */
|
|
451
|
+
/* Dark primary becomes lighter shade for dark backgrounds */
|
|
452
|
+
```
|
|
453
|
+
|
|
454
|
+
---
|
|
455
|
+
|
|
456
|
+
## Best Practices
|
|
457
|
+
|
|
458
|
+
### DO:
|
|
459
|
+
- ✅ Use 60-30-10 rule for balance
|
|
460
|
+
- ✅ Generate full 9-shade scale for each brand color
|
|
461
|
+
- ✅ Test contrast ratios (min 4.5:1)
|
|
462
|
+
- ✅ Use semantic colors consistently
|
|
463
|
+
- ✅ Define colors once (CSS custom properties)
|
|
464
|
+
- ✅ Test for color blindness
|
|
465
|
+
- ✅ Use color harmony principles
|
|
466
|
+
|
|
467
|
+
### DON'T:
|
|
468
|
+
- ❌ Use too many colors (max 3-4 brand colors)
|
|
469
|
+
- ❌ Rely on color alone to convey meaning
|
|
470
|
+
- ❌ Use pure black (#000) for text (too harsh)
|
|
471
|
+
- ❌ Hardcode color values everywhere
|
|
472
|
+
- ❌ Skip accessibility checks
|
|
473
|
+
- ❌ Ignore color psychology
|
|
474
|
+
- ❌ Use color without purpose
|
|
475
|
+
|
|
476
|
+
---
|
|
477
|
+
|
|
478
|
+
## Quick Reference
|
|
479
|
+
|
|
480
|
+
**Color Palette Checklist:**
|
|
481
|
+
- [ ] Primary color (30%) - Brand identity
|
|
482
|
+
- [ ] Secondary/accent (10%) - Emphasis
|
|
483
|
+
- [ ] Neutrals (60%) - Backgrounds, text
|
|
484
|
+
- [ ] Semantic colors - Success, warning, info, error
|
|
485
|
+
- [ ] 9-shade scale for each brand color
|
|
486
|
+
- [ ] WCAG AA contrast (4.5:1 min)
|
|
487
|
+
- [ ] Color blindness tested
|
|
488
|
+
- [ ] Dark mode support (if needed)
|
|
489
|
+
|
|
490
|
+
**Color Harmony Quick Guide:**
|
|
491
|
+
- **Safe**: Monochromatic (1 hue, multiple shades)
|
|
492
|
+
- **Balanced**: Complementary (opposite colors, 60-30-10)
|
|
493
|
+
- **Cohesive**: Analogous (adjacent colors, smooth)
|
|
494
|
+
- **Vibrant**: Triadic (3 evenly spaced, playful)
|
|
495
|
+
|
|
496
|
+
---
|
|
497
|
+
|
|
498
|
+
**💡 Remember:** Color is communication. Choose intentionally, apply consistently!
|