picasso-skill 1.2.0 → 1.3.1

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.
@@ -7,7 +7,9 @@
7
7
  4. Dark Mode
8
8
  5. Accessibility
9
9
  6. CSS Variables Pattern
10
- 7. Common Mistakes
10
+ 7. Curated Color Palettes
11
+ 8. Wide Gamut Colors (P3)
12
+ 9. Common Mistakes
11
13
 
12
14
  ---
13
15
 
@@ -163,7 +165,254 @@ For component-level overrides:
163
165
 
164
166
  ---
165
167
 
166
- ## 7. Common Mistakes
168
+ ## 7. Curated Color Palettes
169
+
170
+ Ten tested OKLCH palettes ready to drop into any project. Each includes a complete token set. Copy the one that fits your domain, then adjust chroma and hue to taste.
171
+
172
+ ### 7.1 Warm Terracotta
173
+ **Vibe**: Earthy, grounded, artisanal. Good for lifestyle brands, wellness, real estate, organic products.
174
+ ```css
175
+ :root {
176
+ --surface-0: oklch(0.98 0.008 55);
177
+ --surface-1: oklch(0.95 0.012 55);
178
+ --text-primary: oklch(0.18 0.025 55);
179
+ --text-secondary: oklch(0.42 0.02 55);
180
+ --accent: oklch(0.58 0.16 45);
181
+ --accent-hover: oklch(0.52 0.18 45);
182
+ --accent-subtle: oklch(0.93 0.04 45);
183
+ --border: oklch(0.87 0.015 55);
184
+ --success: oklch(0.55 0.16 155);
185
+ --warning: oklch(0.68 0.16 75);
186
+ --error: oklch(0.55 0.20 25);
187
+ }
188
+ ```
189
+
190
+ ### 7.2 Forest Green
191
+ **Vibe**: Natural, sustainable, trustworthy. Good for fintech, health, environmental, agriculture.
192
+ ```css
193
+ :root {
194
+ --surface-0: oklch(0.98 0.006 145);
195
+ --surface-1: oklch(0.96 0.01 145);
196
+ --text-primary: oklch(0.17 0.03 150);
197
+ --text-secondary: oklch(0.40 0.02 150);
198
+ --accent: oklch(0.52 0.14 155);
199
+ --accent-hover: oklch(0.46 0.16 155);
200
+ --accent-subtle: oklch(0.93 0.04 155);
201
+ --border: oklch(0.88 0.012 145);
202
+ --success: oklch(0.55 0.16 145);
203
+ --warning: oklch(0.66 0.16 80);
204
+ --error: oklch(0.55 0.20 25);
205
+ }
206
+ ```
207
+
208
+ ### 7.3 Amber Gold
209
+ **Vibe**: Premium, confident, optimistic. Good for finance, luxury SaaS, productivity tools.
210
+ ```css
211
+ :root {
212
+ --surface-0: oklch(0.99 0.005 85);
213
+ --surface-1: oklch(0.96 0.01 85);
214
+ --text-primary: oklch(0.16 0.02 85);
215
+ --text-secondary: oklch(0.40 0.018 85);
216
+ --accent: oklch(0.68 0.18 75);
217
+ --accent-hover: oklch(0.62 0.20 75);
218
+ --accent-subtle: oklch(0.94 0.04 75);
219
+ --border: oklch(0.88 0.012 85);
220
+ --success: oklch(0.55 0.16 150);
221
+ --warning: oklch(0.68 0.18 75);
222
+ --error: oklch(0.55 0.20 28);
223
+ }
224
+ ```
225
+
226
+ ### 7.4 Coral Salmon
227
+ **Vibe**: Warm, energetic, approachable. Good for social apps, creative tools, food and hospitality.
228
+ ```css
229
+ :root {
230
+ --surface-0: oklch(0.98 0.006 30);
231
+ --surface-1: oklch(0.96 0.01 30);
232
+ --text-primary: oklch(0.18 0.02 30);
233
+ --text-secondary: oklch(0.42 0.018 30);
234
+ --accent: oklch(0.65 0.20 25);
235
+ --accent-hover: oklch(0.58 0.22 25);
236
+ --accent-subtle: oklch(0.94 0.04 25);
237
+ --border: oklch(0.88 0.012 30);
238
+ --success: oklch(0.55 0.16 150);
239
+ --warning: oklch(0.66 0.16 75);
240
+ --error: oklch(0.52 0.22 20);
241
+ }
242
+ ```
243
+
244
+ ### 7.5 Deep Teal
245
+ **Vibe**: Calm, medical, authoritative. Good for health tech, enterprise SaaS, data platforms, legal.
246
+ ```css
247
+ :root {
248
+ --surface-0: oklch(0.98 0.005 195);
249
+ --surface-1: oklch(0.96 0.008 195);
250
+ --text-primary: oklch(0.16 0.025 200);
251
+ --text-secondary: oklch(0.40 0.02 200);
252
+ --accent: oklch(0.52 0.12 195);
253
+ --accent-hover: oklch(0.46 0.14 195);
254
+ --accent-subtle: oklch(0.93 0.03 195);
255
+ --border: oklch(0.88 0.01 195);
256
+ --success: oklch(0.55 0.14 155);
257
+ --warning: oklch(0.66 0.16 75);
258
+ --error: oklch(0.55 0.20 25);
259
+ }
260
+ ```
261
+
262
+ ### 7.6 Slate Blue
263
+ **Vibe**: Professional, systematic, dependable. Good for project management, B2B SaaS, documentation.
264
+ ```css
265
+ :root {
266
+ --surface-0: oklch(0.98 0.005 250);
267
+ --surface-1: oklch(0.96 0.008 250);
268
+ --text-primary: oklch(0.17 0.02 250);
269
+ --text-secondary: oklch(0.42 0.018 250);
270
+ --accent: oklch(0.55 0.14 250);
271
+ --accent-hover: oklch(0.49 0.16 250);
272
+ --accent-subtle: oklch(0.93 0.03 250);
273
+ --border: oklch(0.88 0.01 250);
274
+ --success: oklch(0.55 0.16 150);
275
+ --warning: oklch(0.66 0.16 75);
276
+ --error: oklch(0.55 0.20 25);
277
+ }
278
+ ```
279
+
280
+ ### 7.7 Burgundy
281
+ **Vibe**: Sophisticated, editorial, rich. Good for wine/food, publishing, luxury, fashion.
282
+ ```css
283
+ :root {
284
+ --surface-0: oklch(0.98 0.006 10);
285
+ --surface-1: oklch(0.96 0.01 10);
286
+ --text-primary: oklch(0.16 0.025 10);
287
+ --text-secondary: oklch(0.40 0.02 10);
288
+ --accent: oklch(0.42 0.16 15);
289
+ --accent-hover: oklch(0.36 0.18 15);
290
+ --accent-subtle: oklch(0.93 0.04 15);
291
+ --border: oklch(0.87 0.012 10);
292
+ --success: oklch(0.55 0.16 150);
293
+ --warning: oklch(0.66 0.16 75);
294
+ --error: oklch(0.50 0.20 25);
295
+ }
296
+ ```
297
+
298
+ ### 7.8 Sage
299
+ **Vibe**: Soft, organic, restorative. Good for wellness, meditation, journaling, therapy platforms.
300
+ ```css
301
+ :root {
302
+ --surface-0: oklch(0.98 0.006 130);
303
+ --surface-1: oklch(0.95 0.012 130);
304
+ --text-primary: oklch(0.20 0.02 130);
305
+ --text-secondary: oklch(0.42 0.018 130);
306
+ --accent: oklch(0.58 0.10 130);
307
+ --accent-hover: oklch(0.52 0.12 130);
308
+ --accent-subtle: oklch(0.93 0.03 130);
309
+ --border: oklch(0.88 0.01 130);
310
+ --success: oklch(0.55 0.14 150);
311
+ --warning: oklch(0.66 0.15 75);
312
+ --error: oklch(0.55 0.18 25);
313
+ }
314
+ ```
315
+
316
+ ### 7.9 Charcoal with Orange Accent
317
+ **Vibe**: Bold, industrial, high-contrast. Good for dev tools, gaming, analytics, creative coding.
318
+ ```css
319
+ :root {
320
+ --surface-0: oklch(0.97 0.003 60);
321
+ --surface-1: oklch(0.94 0.005 60);
322
+ --text-primary: oklch(0.15 0.01 60);
323
+ --text-secondary: oklch(0.40 0.01 60);
324
+ --accent: oklch(0.65 0.22 55);
325
+ --accent-hover: oklch(0.58 0.24 55);
326
+ --accent-subtle: oklch(0.94 0.04 55);
327
+ --border: oklch(0.86 0.008 60);
328
+ --success: oklch(0.55 0.16 150);
329
+ --warning: oklch(0.66 0.18 70);
330
+ --error: oklch(0.55 0.22 25);
331
+ }
332
+ ```
333
+
334
+ ### 7.10 Monochrome Black and White
335
+ **Vibe**: Stark, typographic, gallery-like. Good for portfolios, photography, editorial, minimal SaaS.
336
+ ```css
337
+ :root {
338
+ --surface-0: oklch(0.99 0.000 0);
339
+ --surface-1: oklch(0.96 0.000 0);
340
+ --text-primary: oklch(0.13 0.000 0);
341
+ --text-secondary: oklch(0.45 0.000 0);
342
+ --accent: oklch(0.15 0.000 0);
343
+ --accent-hover: oklch(0.25 0.000 0);
344
+ --accent-subtle: oklch(0.93 0.000 0);
345
+ --border: oklch(0.85 0.000 0);
346
+ --success: oklch(0.50 0.14 150);
347
+ --warning: oklch(0.62 0.14 75);
348
+ --error: oklch(0.50 0.18 25);
349
+ }
350
+ ```
351
+
352
+ For the monochrome palette, the accent is near-black. CTAs rely on fill weight (solid black buttons with white text) rather than color. Semantic colors (success, warning, error) break the monochrome intentionally so they remain functional.
353
+
354
+ ---
355
+
356
+ ## 8. Wide Gamut Colors (P3)
357
+
358
+ ### What is Display P3?
359
+ Display P3 is a color space that covers roughly 25% more visible colors than sRGB. Modern Apple devices, most OLED screens, and recent monitors support it. Colors outside the sRGB gamut appear more vivid without being oversaturated.
360
+
361
+ ### CSS Syntax
362
+ ```css
363
+ /* Display P3 via color() function */
364
+ --accent: color(display-p3 0.92 0.34 0.15); /* vivid orange impossible in sRGB */
365
+ --success: color(display-p3 0.18 0.75 0.35); /* richer green */
366
+ --highlight: color(display-p3 1 0.85 0); /* pure P3 yellow */
367
+ ```
368
+
369
+ ### Feature Detection
370
+ ```css
371
+ @media (color-gamut: p3) {
372
+ :root {
373
+ --accent: color(display-p3 0.92 0.34 0.15);
374
+ --success: color(display-p3 0.18 0.75 0.35);
375
+ }
376
+ }
377
+ ```
378
+
379
+ ### Progressive Enhancement Pattern
380
+ Always define an sRGB fallback first, then override for wide gamut displays. This ensures every screen gets a reasonable color.
381
+
382
+ ```css
383
+ :root {
384
+ /* sRGB fallback (works everywhere) */
385
+ --accent: oklch(0.65 0.22 35);
386
+ --success: oklch(0.55 0.18 150);
387
+ --highlight: oklch(0.82 0.18 90);
388
+ }
389
+
390
+ @media (color-gamut: p3) {
391
+ :root {
392
+ /* P3 override (wider gamut screens) */
393
+ --accent: oklch(0.65 0.27 35); /* push chroma beyond sRGB limit */
394
+ --success: oklch(0.55 0.22 150);
395
+ --highlight: oklch(0.82 0.22 90);
396
+ }
397
+ }
398
+ ```
399
+
400
+ Note: OKLCH values automatically map to the widest gamut the browser and display support. Increasing chroma beyond ~0.15-0.20 (depending on hue) often pushes into P3 territory. This makes OKLCH the ideal space for progressive enhancement because you write one value and the browser resolves it to the best available gamut.
401
+
402
+ ### When to Use P3
403
+ - Hero gradients and accent splashes where vibrancy matters
404
+ - Success/error states that need to "pop" on capable screens
405
+ - Brand colors that were designed in P3 (increasingly common)
406
+ - Image overlays and tinted surfaces that blend with wide-gamut photography
407
+
408
+ ### When NOT to Use P3
409
+ - Body text colors (perceptual difference is negligible)
410
+ - Border and surface tokens (subtle differences, not worth the complexity)
411
+ - Any context where the sRGB version already looks correct
412
+
413
+ ---
414
+
415
+ ## 9. Common Mistakes
167
416
 
168
417
  - Using pure black (#000) for text (use tinted near-black instead)
169
418
  - Using gray text on colored backgrounds (low contrast, hard to read)
@@ -0,0 +1,193 @@
1
+ # Conversion Design & Landing Page Reference
2
+
3
+ ## 1. Landing Page Anatomy
4
+
5
+ ### Hero Section Variations
6
+
7
+ | Pattern | Best For | Key Spec |
8
+ |---------|----------|----------|
9
+ | **Split** (text left, visual right) | SaaS, B2B | 50/50 or 60/40 split; text column gets primary CTA |
10
+ | **Centered** (text stacked over image) | Brand launches, simple products | Max 600-700px text width; single focal CTA below headline |
11
+ | **Full-bleed media** (text overlay) | Lifestyle, hospitality, portfolios | 4.5:1 contrast on overlay text; darken overlay at 40-60% opacity |
12
+ | **Video background** | High-engagement storytelling | Auto-mute; < 5s to first frame; fallback static image required |
13
+
14
+ **Above-the-fold priorities (in order):** Value proposition headline, supporting subhead (1-2 sentences), primary CTA, trust signal (logo bar or stat).
15
+
16
+ Users form an opinion in **50 milliseconds**. Every extra 100KB in hero media increases bounce by ~1.8%.
17
+
18
+ ### CTA Design
19
+
20
+ - **Minimum size:** 44x44px (Apple/WCAG), 48x48px (Material).
21
+ - **Color:** 3:1+ contrast ratio against background; prominence matters more than specific color.
22
+ - **Placement:** Above fold in hero; repeat after mid-page value build; repeat near final content.
23
+ - **Copy:** First-person ("Start my free trial") outperforms second-person by 10-90%.
24
+ - **Repetition:** Single consistent CTA repeated 2-3 times, not multiple competing actions.
25
+
26
+ ### Social Proof Patterns
27
+
28
+ | Type | Effectiveness | Placement |
29
+ |------|--------------|-----------|
30
+ | Star ratings + reviews | 82% influence | Near pricing/CTA |
31
+ | Customer testimonials | 78% influence | After feature sections |
32
+ | Video testimonials | +34% conversion lift | Mid-page or dedicated section |
33
+ | Client logos | Trust signal | Directly below hero |
34
+ | User count / stats | Up to +43% conversion | Hero section or sub-hero |
35
+ | Security badges | Reduces abandonment | Near forms and payment |
36
+
37
+ ### Pricing Page Design
38
+
39
+ **3 tiers optimal** (center-stage effect). Structure per card:
40
+ 1. Tier name + "best for" one-liner
41
+ 2. Price with billing toggle (default annual; show savings as % AND dollar)
42
+ 3. Primary CTA button (below price, above features)
43
+ 4. 8-12 core features with checkmarks/values
44
+
45
+ **Highlight recommended tier:** Distinct background, "Most Popular" badge, border emphasis, or elevation. Produces 12-15% lift in mid-tier selection.
46
+
47
+ ---
48
+
49
+ ## 2. Conversion Psychology
50
+
51
+ ### Visual Hierarchy for Conversion
52
+
53
+ Follow the **F-pattern**: headline, key benefit, and CTA along the top-left-to-bottom path. **Z-pattern** for simpler pages: logo top-left, nav CTA top-right, content center diagonal, conversion CTA bottom-right.
54
+
55
+ ### Scarcity & Urgency (Ethical Only)
56
+ - Real-time inventory counts -- only truthful data.
57
+ - Time-limited offers with visible countdown -- only genuine deadlines.
58
+ - Social proof urgency ("42 people viewing") -- must reflect real data.
59
+
60
+ ### Trust Signals Hierarchy
61
+ 1. Security badges (SSL, payment logos) -- near checkout/forms.
62
+ 2. Money-back guarantees -- near CTA.
63
+ 3. Third-party reviews (G2, Trustpilot) -- 82% influence.
64
+ 4. Customer logos -- below hero.
65
+ 5. Certifications (SOC 2, GDPR, HIPAA) -- footer or trust section.
66
+
67
+ ### Friction Reduction
68
+ - Each additional form field reduces completion by 3-5%.
69
+ - Multi-step forms: 300% higher conversion on mobile vs single long form.
70
+ - Progress bars: +20-30% form completion when visible.
71
+ - Smart defaults: pre-fill known data; appropriate input types.
72
+ - Single-column layout mandatory on mobile.
73
+ - Inline validation on blur, not on submit.
74
+
75
+ ---
76
+
77
+ ## 3. Mobile Conversion Patterns
78
+
79
+ ### Sticky CTAs
80
+ - Position 100-150px from bottom viewport, above gesture areas.
81
+ - 10-20% conversion improvement on long pages.
82
+ - Must not cover critical content; include dismiss option.
83
+ - Pair with micro trust note: "No credit card required."
84
+
85
+ ### Thumb Zone Design
86
+ - **Primary actions:** Lower-center of screen (natural thumb reach).
87
+ - **Navigation:** Bottom bar with 3-5 destinations.
88
+ - **Avoid:** Top corners for frequent actions.
89
+ - **Tap targets:** Minimum 48px square with spacing.
90
+
91
+ ### Bottom Sheets & Swipe
92
+ - Bottom sheets for secondary actions, filters, confirmations.
93
+ - Swipe-to-dismiss for non-critical modals.
94
+ - Swipe actions on list items for quick operations.
95
+
96
+ ### One-Tap Actions
97
+ - Apple Pay / Google Pay for instant checkout.
98
+ - Social login to reduce signup friction.
99
+ - Quick-reply chips in notifications and chat.
100
+
101
+ ---
102
+
103
+ ## 4. Navigation & Information Architecture
104
+
105
+ ### Navigation by App Type
106
+
107
+ | App Type | Primary Pattern | Key Feature |
108
+ |----------|----------------|-------------|
109
+ | **SaaS** | Left sidebar + top bar | Collapsible sidebar; breadcrumbs for depth |
110
+ | **E-commerce** | Mega menu + category nav | Faceted filtering; persistent cart with count |
111
+ | **Content** | Top nav + hamburger (mobile) | Search-forward; reading progress indicator |
112
+ | **Social** | Bottom tab bar (mobile) | 3-5 tabs; notification badges; create center |
113
+
114
+ ### Search UX
115
+ - Autocomplete after 2-3 characters; limit to 5-7 results.
116
+ - Display recent searches on focus before typing.
117
+ - Surface top 3-5 filters inline; bottom sheet for advanced.
118
+ - No results: offer spelling corrections, related terms, category browsing.
119
+
120
+ ### Infinite Scroll vs Pagination
121
+
122
+ | Criterion | Pagination | Infinite Scroll | Load More |
123
+ |-----------|-----------|----------------|-----------|
124
+ | Content type | Structured data, tables | Discovery feeds, social | Catalogs, search |
125
+ | User intent | Find specific item | Browse/explore | Mixed |
126
+ | SEO need | High (unique URLs) | Low | Medium |
127
+ | Accessibility | Best | Worst | Good |
128
+ | Mobile performance | Good | Memory risk | Good |
129
+
130
+ ### Breadcrumbs
131
+ Use for hierarchies 3+ levels deep. Place below top nav, above page title. Truncate middle items on mobile with ellipsis.
132
+
133
+ ---
134
+
135
+ ## 5. Onboarding UX
136
+
137
+ ### Progressive Onboarding Framework
138
+
139
+ **Phase 1 -- Signup:** Ask only email + password (or social login). Defer profile details until after first value moment.
140
+
141
+ **Phase 2 -- First-run experience:** Welcome screen with 1-2 sentence value prop. 3-5 step setup wizard for essential configuration. Pre-populated sample data so the product feels alive.
142
+
143
+ **Phase 3 -- Feature discovery (ongoing):** Contextual tooltips triggered by user behavior, not on first load. Checklist widget showing setup progress (drives 70%+ completion). Celebrate milestones.
144
+
145
+ ### Tooltips vs Modals vs Coachmarks
146
+
147
+ | Pattern | Use When | Avoid When |
148
+ |---------|----------|------------|
149
+ | **Tooltips** | Explaining a single element | More than 1-2 on screen |
150
+ | **Modals** | Critical announcements, required input | Interrupting flow; never on first load for tours |
151
+ | **Coachmarks** | Introducing 3-5 key features in sequence | Users are mid-task; keep under 5 steps |
152
+ | **Hotspots** | Passive discovery of new features | Overuse trains users to ignore them |
153
+
154
+ ### Empty States
155
+ Every empty state needs: (1) Illustration/icon, (2) Brief explanation, (3) Primary action CTA, (4) Optional link to docs/help.
156
+
157
+ ---
158
+
159
+ ## 6. Email & Notification Design
160
+
161
+ ### Transactional Email Structure
162
+ Brand header, clear subject line, single-column body at 600px max width, primary action button (min 44px height, full-width mobile), minimal footer with unsubscribe.
163
+
164
+ ### Notification Hierarchy
165
+
166
+ | Level | Channel | Timing |
167
+ |-------|---------|--------|
168
+ | **Urgent** | Push + in-app + email | Immediate |
169
+ | **Informational** | In-app + email | Batched or near-real-time |
170
+ | **Promotional** | Email only | Scheduled; respect quiet hours |
171
+
172
+ ### Push Notification UX
173
+ - 40-50 character headline max.
174
+ - Deep-link to relevant screen, not app home.
175
+ - Limit to 3-5 per day.
176
+ - Implement quiet hours (default 10 PM - 8 AM local time).
177
+
178
+ ---
179
+
180
+ ## Quick Reference: Conversion Numbers
181
+
182
+ | Metric | Value |
183
+ |--------|-------|
184
+ | First impression time | 50ms |
185
+ | Mobile bounce if load > 3s | 53% |
186
+ | First-person CTA copy lift | 10-90% |
187
+ | Drop per extra form field | 3-5% |
188
+ | Progress bar completion boost | 20-30% |
189
+ | Multi-step form mobile lift | up to 300% |
190
+ | Video testimonial lift | +34% |
191
+ | Sticky mobile CTA lift | 10-20% |
192
+ | "Most Popular" badge lift | 12-15% |
193
+ | Per extra second load time | 7-10% drop |
@@ -0,0 +1,226 @@
1
+ # Data Visualization & Dashboard Design Reference
2
+
3
+ ## 1. Chart Selection Decision Matrix
4
+
5
+ Select charts by the **question your data answers**, not by what looks interesting.
6
+
7
+ | Purpose | Recommended Charts | Avoid |
8
+ |---|---|---|
9
+ | **Comparison** (categories vs values) | Bar (vertical/horizontal), Grouped bar, Lollipop | Pie (hard to compare slices) |
10
+ | **Trend over time** (time-series) | Line, Area, Sparkline | Bar (unless discrete intervals) |
11
+ | **Composition** (parts of a whole) | Stacked bar, Pie/Donut (<=6 slices), Treemap | Line chart |
12
+ | **Distribution** (spread/frequency) | Histogram, Box plot, Violin, Scatter | Pie chart |
13
+ | **Relationship** (two+ numeric vars) | Scatter, Bubble (3rd variable as size) | Bar chart |
14
+ | **Ranking** (ordered comparison) | Horizontal bar (sorted), Lollipop | Pie/Donut |
15
+ | **Flow/Conversion** (sequential stages) | Funnel, Sankey | Bar chart |
16
+ | **Performance vs target** (single KPI) | Gauge, Bullet chart | Pie chart |
17
+ | **Inline trend indicator** (compact) | Sparkline (word-sized) | Full chart |
18
+ | **Intensity/correlation** (two categorical axes) | Heatmap | 3D bar charts |
19
+
20
+ ### Quick Decision Flow
21
+
22
+ ```
23
+ What are you showing?
24
+ -> Change over time? -> Line (continuous) / Bar (discrete intervals)
25
+ -> Comparison? -> Bar (horizontal if labels are long)
26
+ -> Part of whole? -> Donut (<=6 cats) / Treemap (many) / Stacked bar (over time)
27
+ -> Relationship? -> Scatter / Bubble
28
+ -> Distribution? -> Histogram / Box plot
29
+ -> Single KPI? -> Big number card with sparkline
30
+ ```
31
+
32
+ ---
33
+
34
+ ## 2. Dashboard Design Patterns
35
+
36
+ ### Layout Patterns
37
+
38
+ **Overview + Detail (most common):** Top row = KPI summary cards. Middle = primary charts. Bottom = detailed tables or drill-down views.
39
+
40
+ **Drill-Down:** Start with high-level aggregates; clicking reveals progressively granular data. Use breadcrumbs for navigation context.
41
+
42
+ **Contextual/Filtered:** Global filter bar at top. All panels respond to the same filter state.
43
+
44
+ ### Grid System
45
+
46
+ Use a **12-column grid** with 16-24px gutters.
47
+
48
+ ```
49
+ | KPI | KPI | KPI | KPI | <- 3-col each (4 cards)
50
+ | Primary Chart | Secondary | <- 8-col + 4-col
51
+ | Data Table | <- 12-col full width
52
+ ```
53
+
54
+ ### KPI Card Anatomy
55
+
56
+ ```
57
+ +----------------------------------+
58
+ | Revenue +12.3% ^ | <- Label + trend indicator
59
+ | $1,234,567 | <- Primary metric (large)
60
+ | vs $1,098,000 target | <- Comparison context
61
+ | ________ sparkline | <- Trend line (last 30 days)
62
+ +----------------------------------+
63
+ ```
64
+
65
+ **Rules:**
66
+ - Always pair KPIs with context (target, prior period, benchmark).
67
+ - Semantic color only for status: green = on track, amber = warning, red = critical.
68
+ - Show "Last updated" timestamp on every dashboard.
69
+ - Limit to 4-8 KPI cards maximum per view.
70
+
71
+ ### Real-Time Data Display
72
+
73
+ - Visible "live" indicator or timestamp for data freshness.
74
+ - CSS transitions for value changes (fade or count-up animation).
75
+ - Avoid polling faster than ~5s minimum.
76
+
77
+ ---
78
+
79
+ ## 3. Color for Data
80
+
81
+ ### Sequential (low-to-high, single variable)
82
+ ```
83
+ Blues: #f7fbff -> #9ecae1 -> #08519c -> #08306b
84
+ Viridis: #fde725 -> #35b779 -> #31688e -> #440154
85
+ ```
86
+ Light = low, dark = high.
87
+
88
+ ### Diverging (two extremes with neutral midpoint)
89
+ ```
90
+ RdBu: #b2182b -> #f4a582 -> #f7f7f7 -> #92c5de -> #2166ac
91
+ PRGn: #762a83 -> #c2a5cf -> #f7f7f7 -> #a6dba0 -> #1b7837
92
+ ```
93
+ Use for deviation from center (profit/loss, above/below average).
94
+
95
+ ### Qualitative / Categorical (distinct groups)
96
+ ```
97
+ Tableau 10: #4e79a7 #f28e2c #e15759 #76b7b2 #59a14f #edc949 #af7aa1 #ff9da7 #9c755f #bab0ab
98
+ Okabe-Ito: #E69F00 #56B4E9 #009E73 #F0E442 #0072B2 #D55E00 #CC79A7 #000000
99
+ ```
100
+
101
+ ### OKLCH Programmatic Palettes
102
+
103
+ ```css
104
+ /* Sequential: same hue, vary lightness */
105
+ --color-1: oklch(0.95 0.03 250); /* lightest */
106
+ --color-2: oklch(0.75 0.08 250);
107
+ --color-3: oklch(0.55 0.13 250);
108
+ --color-4: oklch(0.35 0.15 250); /* darkest */
109
+
110
+ /* Qualitative: same lightness+chroma, rotate hue */
111
+ --cat-1: oklch(0.7 0.12 30); /* orange */
112
+ --cat-2: oklch(0.7 0.12 230); /* blue */
113
+ --cat-3: oklch(0.7 0.12 150); /* green */
114
+ --cat-4: oklch(0.7 0.12 330); /* pink */
115
+ ```
116
+
117
+ ### Colorblind-Safe Rules
118
+
119
+ 1. **Default to Okabe-Ito** for categorical data.
120
+ 2. **Never use red/green as the only differentiator.**
121
+ 3. **Use Viridis** for sequential scales.
122
+ 4. **Blue is the safest single hue.**
123
+ 5. **Supplement color with shape, pattern, or label** (WCAG 1.4.1).
124
+ 6. **Limit categorical colors to 6-8 max.**
125
+
126
+ ---
127
+
128
+ ## 4. Chart Accessibility
129
+
130
+ ### Text Alternatives (WCAG 1.1.1)
131
+
132
+ ```jsx
133
+ <figure>
134
+ <svg role="img" aria-labelledby="chart-title" aria-describedby="chart-desc">
135
+ <title id="chart-title">Quarterly Revenue</title>
136
+ <desc id="chart-desc">Bar chart showing revenue growth from $1.2M in Q1 to $1.5M in Q4.</desc>
137
+ </svg>
138
+ <details>
139
+ <summary>View data table</summary>
140
+ <table><!-- structured data as accessible fallback --></table>
141
+ </details>
142
+ </figure>
143
+ ```
144
+
145
+ ### Keyboard Navigation
146
+ - All interactive chart elements must be focusable.
147
+ - Arrow keys move between data points within a series.
148
+ - Enter/Space to activate (drill-down, tooltip).
149
+ - Escape to dismiss tooltips.
150
+
151
+ ### Visual Patterns for Colorblindness
152
+ Use SVG fill patterns alongside color so colorblind users and grayscale remain readable.
153
+
154
+ ---
155
+
156
+ ## 5. React Charting Libraries
157
+
158
+ | Library | Best For | Bundle Size | Learning Curve |
159
+ |---|---|---|---|
160
+ | **Recharts** | Standard dashboards, rapid prototyping | Light | Low |
161
+ | **Nivo** | Rich chart variety, theming, SSR | ~371KB/module | Moderate |
162
+ | **Victory** | Cross-platform (React + React Native) | ~1.16MB | Low |
163
+ | **visx** | Custom/brand-specific visualizations | ~12.3KB | High |
164
+ | **Chart.js** | Large datasets (up to 1M points) | 14-48KB | Low |
165
+ | **D3** | Full control, custom viz libraries | Varies | Very High |
166
+
167
+ ```
168
+ Need it fast with standard charts? -> Recharts
169
+ Need rich chart types + theming? -> Nivo
170
+ Need web + React Native? -> Victory
171
+ Need pixel-perfect custom viz? -> visx
172
+ Need to render 100K+ data points? -> Chart.js (Canvas)
173
+ Need full control? -> D3 directly
174
+ ```
175
+
176
+ ### Recharts Example
177
+
178
+ ```tsx
179
+ import { BarChart, Bar, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContainer } from 'recharts';
180
+
181
+ function RevenueChart({ data }) {
182
+ return (
183
+ <ResponsiveContainer width="100%" height={300}>
184
+ <BarChart data={data}>
185
+ <CartesianGrid strokeDasharray="3 3" stroke="#e0e0e0" />
186
+ <XAxis dataKey="month" />
187
+ <YAxis tickFormatter={(v) => `$${v / 1000}k`} />
188
+ <Tooltip formatter={(v) => [`$${v.toLocaleString()}`, 'Revenue']} />
189
+ <Bar dataKey="revenue" fill="#4e79a7" radius={[4, 4, 0, 0]} />
190
+ </BarChart>
191
+ </ResponsiveContainer>
192
+ );
193
+ }
194
+ ```
195
+
196
+ ---
197
+
198
+ ## 6. Data-Ink Ratio (Tufte Principles)
199
+
200
+ ### Core Rules
201
+ 1. **Above all else, show the data.**
202
+ 2. **Maximize data-ink ratio** = (ink used for data) / (total ink).
203
+ 3. **Erase non-data-ink** -- gridlines, borders, backgrounds that carry no information.
204
+ 4. **Erase redundant data-ink** -- if a label says "42%", you don't also need a gridline at 42.
205
+
206
+ ### Remove (Chartjunk)
207
+ 3D effects, gradient fills, heavy gridlines, decorative icons, redundant legends, box borders around charts, background colors (unless encoding data).
208
+
209
+ ### Add
210
+ Direct labels on bars/lines, annotations on key events, reference lines (target, average, benchmark).
211
+
212
+ ### Small Multiples
213
+ Instead of one cluttered multi-series chart, repeat the same simple chart for each category. Same axes, same scale, side by side.
214
+
215
+ ### Sparklines
216
+ Word-sized graphics embedded inline. No axes, no labels -- pure trend.
217
+
218
+ ```tsx
219
+ <ResponsiveContainer width={80} height={20}>
220
+ <LineChart data={trend}>
221
+ <Line type="monotone" dataKey="value" stroke="#4e79a7" dot={false} strokeWidth={1.5} />
222
+ </LineChart>
223
+ </ResponsiveContainer>
224
+ ```
225
+
226
+ Use in: KPI cards, table cells, inline with text.