@salesforce/mcp-provider-lwc-experts 0.6.3 → 0.6.4

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.
Files changed (58) hide show
  1. package/index.bundle.js +109 -117
  2. package/knowledge/graphql/generation-guide.md +212 -0
  3. package/knowledge/graphql/generation-mutation.md +265 -0
  4. package/knowledge/graphql/generation-query.md +235 -0
  5. package/knowledge/graphql/generation-schema.md +20 -0
  6. package/knowledge/graphql/schema/shared.graphqls +1140 -0
  7. package/knowledge/o11y/activityApi.md +64 -0
  8. package/knowledge/o11y/bestPractices.md +106 -0
  9. package/knowledge/o11y/counterMetrics.md +61 -0
  10. package/knowledge/o11y/errorTracking.md +70 -0
  11. package/knowledge/o11y/initialization.md +46 -0
  12. package/knowledge/o11y/lifecycleInstrumentation.md +91 -0
  13. package/knowledge/o11y/logApi.md +53 -0
  14. package/knowledge/o11y/schemaUsage.md +48 -0
  15. package/knowledge/slds/styling-hooks/README.md +408 -0
  16. package/knowledge/slds/styling-hooks/categories/color.md +963 -0
  17. package/knowledge/slds/styling-hooks/categories/radius.md +526 -0
  18. package/knowledge/slds/styling-hooks/categories/shadow.md +489 -0
  19. package/knowledge/slds/styling-hooks/categories/sizing.md +667 -0
  20. package/knowledge/slds/styling-hooks/categories/spacing.md +501 -0
  21. package/knowledge/slds/styling-hooks/categories/typography.md +708 -0
  22. package/knowledge/slds/styling-hooks/global-semantic/accent-hooks.md +207 -0
  23. package/knowledge/slds/styling-hooks/global-semantic/feedback-hooks.md +819 -0
  24. package/knowledge/slds/styling-hooks/global-semantic/surface-hooks.md +215 -0
  25. package/knowledge/slds/styling-hooks/guidance.md +906 -0
  26. package/knowledge/slds/styling-hooks/metadata/hooks-index.json +6576 -0
  27. package/knowledge/utam/generation-guide.md +499 -0
  28. package/knowledge/utam/generation-workflow.md +243 -0
  29. package/knowledge/utam/namespaces-mapping.md +26 -0
  30. package/knowledge/utam/utam-json-schema.md +720 -0
  31. package/knowledge/utils.ts +27 -0
  32. package/package.json +4 -3
  33. /package/{agents → experts}/lds/resources/lwc/guides/reference/reference-create-list-info.md +0 -0
  34. /package/{agents → experts}/lds/resources/lwc/guides/reference/reference-create-record.md +0 -0
  35. /package/{agents → experts}/lds/resources/lwc/guides/reference/reference-delete-list-info.md +0 -0
  36. /package/{agents → experts}/lds/resources/lwc/guides/reference/reference-delete-record.md +0 -0
  37. /package/{agents → experts}/lds/resources/lwc/guides/reference/reference-get-list-info-by-name.md +0 -0
  38. /package/{agents → experts}/lds/resources/lwc/guides/reference/reference-get-list-infos-by-name.md +0 -0
  39. /package/{agents → experts}/lds/resources/lwc/guides/reference/reference-get-list-infos-by-object-name.md +0 -0
  40. /package/{agents → experts}/lds/resources/lwc/guides/reference/reference-get-list-object-info.md +0 -0
  41. /package/{agents → experts}/lds/resources/lwc/guides/reference/reference-get-list-preferences.md +0 -0
  42. /package/{agents → experts}/lds/resources/lwc/guides/reference/reference-get-list-records-by-name.md +0 -0
  43. /package/{agents → experts}/lds/resources/lwc/guides/reference/reference-update-list-info.md +0 -0
  44. /package/{agents → experts}/lds/resources/lwc/guides/reference/reference-update-list-preferences.md +0 -0
  45. /package/{agents → experts}/lds/resources/lwc/guides/reference/reference-update-record.md +0 -0
  46. /package/{agents → experts}/lds/resources/lwc/guides/reference/wire-adapters/lds-wire-adapter-types.json +0 -0
  47. /package/{agents → experts}/lds/resources/lwc/guides/reference/wire-adapters/reference-wire-adapters-get-related-list-count.md +0 -0
  48. /package/{agents → experts}/lds/resources/lwc/guides/reference/wire-adapters/reference-wire-adapters-get-related-list-info-batch.md +0 -0
  49. /package/{agents → experts}/lds/resources/lwc/guides/reference/wire-adapters/reference-wire-adapters-get-related-list-info.md +0 -0
  50. /package/{agents → experts}/lds/resources/lwc/guides/reference/wire-adapters/reference-wire-adapters-get-related-list-records-batch.md +0 -0
  51. /package/{agents → experts}/lds/resources/lwc/guides/reference/wire-adapters/reference-wire-adapters-get-related-list-records.md +0 -0
  52. /package/{agents → experts}/lds/resources/lwc/guides/reference/wire-adapters/reference-wire-adapters-get-related-lists-info.md +0 -0
  53. /package/{agents → experts}/lds/resources/lwc/guides/reference/wire-adapters/reference-wire-adapters-object-info.md +0 -0
  54. /package/{agents → experts}/lds/resources/lwc/guides/reference/wire-adapters/reference-wire-adapters-object-infos.md +0 -0
  55. /package/{agents → experts}/lds/resources/lwc/guides/reference/wire-adapters/reference-wire-adapters-picklist-values-record.md +0 -0
  56. /package/{agents → experts}/lds/resources/lwc/guides/reference/wire-adapters/reference-wire-adapters-picklist-values.md +0 -0
  57. /package/{agents → experts}/lds/resources/lwc/guides/reference/wire-adapters/reference-wire-adapters-record.md +0 -0
  58. /package/{agents → experts}/lds/resources/lwc/guides/reference/wire-adapters/reference-wire-adapters-records.md +0 -0
@@ -0,0 +1,963 @@
1
+ # SLDS Color System: Comprehensive Guide for Coding Agents
2
+
3
+ ## Overview
4
+
5
+ The SLDS color system includes **~312 color hooks** organized into a three-tier hierarchy. This guide explains when and how to use each tier effectively.
6
+
7
+ ---
8
+
9
+ ## Three-Tier Color System
10
+
11
+ SLDS organizes colors into three tiers, each serving a different purpose:
12
+
13
+ ### 1. Semantic UI Colors (PREFERRED - Top Tier)
14
+
15
+ **Purpose:** Theme-aware, purpose-driven colors that automatically adapt to themes and modes.
16
+
17
+ **When to use:** Default choice for all UI components and page elements.
18
+
19
+ **Characteristics:**
20
+
21
+ - ✅ Automatically adapt to brand themes, light/dark modes
22
+ - ✅ Named by purpose/location (surface, container, accent, feedback)
23
+ - ✅ Mutable - values change with theme selection
24
+ - ✅ Pre-validated accessibility pairings (e.g., accent-container + on-accent)
25
+
26
+ **Available Semantic Colors:**
27
+
28
+ - **Accent Colors:** ✅ 12 hooks available (`accent-1/2/3`, `accent-container-1/2/3`, `border-accent-1/2/3`, `on-accent-1/2/3`)
29
+ - **Surface Colors:** 🚧 Exist in SLDS but not yet in knowledge base
30
+ - **Container Colors:** 🚧 Exist in SLDS but not yet in knowledge base
31
+ - **Feedback Colors:** 🚧 Exist in SLDS but not yet in knowledge base
32
+ - **On Colors:** 🚧 Exist in SLDS but not yet in knowledge base (except on-accent)
33
+
34
+ **Examples:**
35
+
36
+ ```css
37
+ /* Semantic accent colors - currently available */
38
+ background: var(--slds-g-color-accent-container-1);
39
+ color: var(--slds-g-color-on-accent-1);
40
+
41
+ /* Semantic surface colors - coming soon */
42
+ background: var(--slds-g-color-surface-1); /* Not yet in knowledge base */
43
+ color: var(--slds-g-color-on-surface-2); /* Not yet in knowledge base */
44
+ ```
45
+
46
+ ---
47
+
48
+ ### 2. System Colors (Middle Tier)
49
+
50
+ **Purpose:** Accessible system-wide colors for edge cases where semantic UI colors don't make sense.
51
+
52
+ **When to use:** Only when semantic UI colors (surface, accent, container) don't fit your use case.
53
+
54
+ **Characteristics:**
55
+
56
+ - ✅ Accessible colors used throughout the UI
57
+ - ✅ Named by semantic category (brand, neutral, error, warning, success)
58
+ - ✅ Follow 0-100 scale like palettes
59
+ - ✅ Mutable - values can change with theme
60
+ - ⚠️ Less theme-adaptive than semantic UI colors
61
+
62
+ **Available System Color Families:**
63
+
64
+ #### `--slds-g-color-neutral-base-*`
65
+
66
+ Used for text, surfaces, and non-functional UI elements.
67
+
68
+ - **Levels:** 10, 15, 20, 30, 40, 50, 60, 65, 70, 80, 90, 95, 100
69
+ - **Examples:** `neutral-base-10` (very dark gray), `neutral-base-95` (very light gray)
70
+
71
+ #### `--slds-g-color-brand-base-*`
72
+
73
+ Electric blue for buttons, hover states, selected/active states. **Do not use decoratively.**
74
+
75
+ - **Levels:** 10, 15, 20, 30, 40, 50, 60, 65, 70, 80, 90, 95, 100
76
+ - **Note:** Only use for interactive states, not decoration
77
+
78
+ #### `--slds-g-color-error-base-*` (Pink)
79
+
80
+ **Only** for error feedback states, invalid inputs, destructive actions.
81
+
82
+ - **Levels:** 10, 20, 30, 40, 50, 60, 70, 80, 90, 95, 100
83
+
84
+ #### `--slds-g-color-warning-base-*` (Yellow)
85
+
86
+ **Only** for warning feedback states, caution messages.
87
+
88
+ - **Levels:** 10, 20, 30, 40, 50, 60, 70, 80, 90, 95, 100
89
+
90
+ #### `--slds-g-color-success-base-*` (Teal)
91
+
92
+ **Only** for success feedback states, completed actions.
93
+
94
+ - **Levels:** 10, 20, 30, 40, 50, 60, 70, 80, 90, 95, 100
95
+
96
+ **Example Usage:**
97
+
98
+ ```css
99
+ /* System colors for feedback when semantic feedback hooks aren't available */
100
+ .error-alert {
101
+ background: var(--slds-g-color-error-base-95); /* Light pink background */
102
+ color: var(--slds-g-color-error-base-10); /* Dark pink text */
103
+ border-left: 4px solid var(--slds-g-color-error-base-50);
104
+ }
105
+
106
+ /* System neutral for general UI */
107
+ .text {
108
+ color: var(--slds-g-color-neutral-base-20); /* Dark gray text */
109
+ }
110
+ ```
111
+
112
+ **Important Rules:**
113
+
114
+ - ⚠️ Use only in edge cases where semantic colors don't fit
115
+ - ❌ Don't mix with other color groups (e.g., don't use brand-base with accent-container)
116
+ - ❌ Don't use brand-base/error-base/warning-base/success-base decoratively - only for their intended purpose
117
+
118
+ ---
119
+
120
+ ### 3. Color Palettes (Bottom Tier)
121
+
122
+ **Purpose:** Raw, immutable color values for undefined situations and data visualization.
123
+
124
+ **When to use:** When semantic and system colors don't fit (data viz, custom charts, granular control).
125
+
126
+ **Characteristics:**
127
+
128
+ - ✅ Full spectrum of colors
129
+ - ✅ Follow 0-100 scale with magic numbers (50-point, 40-point separation)
130
+ - ✅ Immutable - values never change regardless of theme
131
+ - ✅ No semantic assignment - can be used anywhere
132
+ - ⚠️ You're responsible for accessibility
133
+
134
+ **Available Palette Families:**
135
+
136
+ - `neutral`, `brand`, `red`, `pink`, `orange`, `yellow`, `green`, `teal`, `cloud-blue`, `blue`, `indigo`, `purple`, `violet`
137
+
138
+ **Examples:**
139
+
140
+ ```css
141
+ /* Palette colors for data visualization */
142
+ .chart-bar-1 {
143
+ fill: var(--slds-g-color-palette-purple-50);
144
+ }
145
+ .chart-bar-2 {
146
+ fill: var(--slds-g-color-palette-cloud-blue-50);
147
+ }
148
+
149
+ /* Palette colors when semantic/system don't exist yet */
150
+ .card {
151
+ background: var(--slds-g-color-palette-neutral-100); /* White */
152
+ color: var(--slds-g-color-palette-neutral-10); /* Near black */
153
+ }
154
+ ```
155
+
156
+ ---
157
+
158
+ ## Palette Color System
159
+
160
+ ### The 0-100 Numerical Scale
161
+
162
+ Palette colors use a 0-100 point scale where **accessibility is mathematically guaranteed**:
163
+
164
+ - **0-100 Scale:** 0 = darkest (black), 100 = lightest (white)
165
+ - **Available Steps:** Every 5 points (0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100)
166
+ - **Cross-Palette Consistency:** Same point values across different color lanes (e.g., blue-50 and green-50 have similar lightness)
167
+
168
+ ### Magic Numbers for Accessibility
169
+
170
+ **Critical Rule:** Point separation determines contrast compliance:
171
+
172
+ | Separation | Contrast Ratio | Use Case | WCAG Level |
173
+ | ------------- | -------------- | -------------------- | ------------- |
174
+ | **50 points** | 4.5:1+ | Text on backgrounds | AA (required) |
175
+ | **40 points** | 3:1+ | UI elements, borders | AA (required) |
176
+
177
+ **Works across hues:** A 50-point separation maintains 4.5:1 contrast even when using different color lanes.
178
+
179
+ **Example:**
180
+
181
+ ```css
182
+ /* ✅ WCAG AA Compliant - 50-point separation */
183
+ .text-example {
184
+ background: var(--slds-g-color-palette-neutral-95); /* Very light */
185
+ color: var(--slds-g-color-palette-neutral-10); /* Very dark */
186
+ /* 85-point separation = excellent contrast (>4.5:1) */
187
+ }
188
+
189
+ /* ✅ WCAG AA Compliant for UI - 40-point separation */
190
+ .border-example {
191
+ background: var(--slds-g-color-palette-neutral-100); /* White */
192
+ border: 1px solid var(--slds-g-color-palette-neutral-60); /* Mid gray */
193
+ /* 40-point separation = compliant for borders (>3:1) */
194
+ }
195
+
196
+ /* ✅ Cross-palette works too */
197
+ .cross-palette {
198
+ background: var(--slds-g-color-palette-blue-20); /* Dark blue */
199
+ color: var(--slds-g-color-palette-green-75); /* Light green */
200
+ /* 55-point separation = compliant */
201
+ }
202
+ ```
203
+
204
+ ### How State Transitions Work with Palettes
205
+
206
+ Use 10-point steps for interactive states:
207
+
208
+ ```css
209
+ .button {
210
+ background: var(--slds-g-color-palette-blue-50); /* Default */
211
+ }
212
+
213
+ .button:hover {
214
+ background: var(--slds-g-color-palette-blue-40); /* Hover: 10 points darker */
215
+ }
216
+
217
+ .button:active {
218
+ background: var(--slds-g-color-palette-blue-30); /* Active: 20 points darker */
219
+ }
220
+ ```
221
+
222
+ ---
223
+
224
+ ## Available Palette Families
225
+
226
+ ### Foundation Palettes (Always Use These First)
227
+
228
+ #### Neutral (Primary Choice)
229
+
230
+ **85% of your UI should use neutral colors**
231
+
232
+ - **Hook Pattern:** `--slds-g-color-palette-neutral-{level}`
233
+ - **Levels:** 0, 5, 10, 15, 20, 30, 40, 50, 60, 70, 80, 90, 95, 100
234
+ - **Use For:**
235
+ - Page backgrounds (95, 100)
236
+ - Text colors (10, 20, 30)
237
+ - Borders and dividers (60, 70)
238
+ - Disabled states (50, 60)
239
+ - Shadows and subtle effects (80, 90)
240
+
241
+ **Common Patterns:**
242
+
243
+ ```css
244
+ /* Page background */
245
+ background: var(--slds-g-color-palette-neutral-100); /* White */
246
+
247
+ /* Surface/card background */
248
+ background: var(--slds-g-color-palette-neutral-95); /* Very light gray */
249
+
250
+ /* Primary text */
251
+ color: var(--slds-g-color-palette-neutral-10); /* Near black */
252
+
253
+ /* Secondary text */
254
+ color: var(--slds-g-color-palette-neutral-30); /* Dark gray */
255
+
256
+ /* Borders */
257
+ border-color: var(--slds-g-color-palette-neutral-70); /* Mid-light gray */
258
+
259
+ /* Disabled text */
260
+ color: var(--slds-g-color-palette-neutral-50); /* Mid gray */
261
+ ```
262
+
263
+ #### Brand
264
+
265
+ **5% of your UI - Use for accent elements only**
266
+
267
+ - **Hook Pattern:** `--slds-g-color-palette-brand-{level}`
268
+ - **Levels:** Same as neutral (0-100 in 5-point steps)
269
+ - **Use For:** Primary actions, brand identity elements
270
+ - **When to Use Semantic Instead:** If accent hooks are available, prefer `--slds-g-color-accent-*` over brand palette
271
+
272
+ ---
273
+
274
+ ### Feedback Palettes (Status Indicators)
275
+
276
+ Use these for system feedback when semantic feedback hooks aren't available:
277
+
278
+ #### Pink (Errors)
279
+
280
+ - **Hook Pattern:** `--slds-g-color-palette-pink-{level}`
281
+ - **Use For:** Error messages, invalid states, destructive actions
282
+ - **Example:** `background: var(--slds-g-color-palette-pink-95); color: var(--slds-g-color-palette-pink-10);`
283
+
284
+ #### Yellow (Warnings)
285
+
286
+ - **Hook Pattern:** `--slds-g-color-palette-yellow-{level}`
287
+ - **Use For:** Warning messages, caution states
288
+ - **Example:** `background: var(--slds-g-color-palette-yellow-95); color: var(--slds-g-color-palette-yellow-10);`
289
+
290
+ #### Teal (Success)
291
+
292
+ - **Hook Pattern:** `--slds-g-color-palette-teal-{level}`
293
+ - **Use For:** Success messages, completed states
294
+ - **Example:** `background: var(--slds-g-color-palette-teal-95); color: var(--slds-g-color-palette-teal-10);`
295
+
296
+ #### Blue (Information)
297
+
298
+ - **Hook Pattern:** `--slds-g-color-palette-blue-{level}`
299
+ - **Use For:** Informational messages, help text
300
+ - **Example:** `background: var(--slds-g-color-palette-blue-95); color: var(--slds-g-color-palette-blue-10);`
301
+
302
+ ---
303
+
304
+ ### Expressive Palettes (Data Visualization - Use Sparingly)
305
+
306
+ **10% of your UI maximum** - Use only when semantic and foundation palettes don't fit.
307
+
308
+ #### Cool Tones (Recommended for General Use)
309
+
310
+ **Cloud Blue**
311
+
312
+ - **Hook Pattern:** `--slds-g-color-palette-cloud-blue-{level}`
313
+ - **Use For:** Data visualization, cool-toned accents
314
+ - **Note:** Use intentionally to avoid confusion with blue (info feedback)
315
+
316
+ **Indigo**
317
+
318
+ - **Hook Pattern:** `--slds-g-color-palette-indigo-{level}`
319
+ - **Use For:** Data visualization
320
+ - **Warning:** Similar to brand color - avoid using for interactive elements that could disrupt button hierarchy
321
+
322
+ **Purple**
323
+
324
+ - **Hook Pattern:** `--slds-g-color-palette-purple-{level}`
325
+ - **Use For:** Data visualization, expressive interfaces
326
+ - **Good For:** Charts, dashboards
327
+
328
+ **Violet**
329
+
330
+ - **Hook Pattern:** `--slds-g-color-palette-violet-{level}`
331
+ - **Use For:** Data visualization emphasis
332
+ - **Good For:** Accent colors in visualizations
333
+
334
+ #### Warm Tones (Use with Caution - Attention-Grabbing)
335
+
336
+ **Green**
337
+
338
+ - **Hook Pattern:** `--slds-g-color-palette-green-{level}`
339
+ - **Use For:** Drawing attention to important information
340
+ - **Warning:** Use sparingly to avoid confusion with teal (success feedback)
341
+
342
+ **Orange**
343
+
344
+ - **Hook Pattern:** `--slds-g-color-palette-orange-{level}`
345
+ - **Use For:** Highlighting critical areas
346
+ - **Warning:** Use sparingly to avoid confusion with yellow (warning feedback)
347
+
348
+ **Hot Orange**
349
+
350
+ - **Hook Pattern:** `--slds-g-color-palette-hot-orange-{level}`
351
+ - **Use For:** Maximum attention-grabbing, critical states
352
+ - **Reserve For:** Truly critical states only
353
+
354
+ **Red**
355
+
356
+ - **Hook Pattern:** `--slds-g-color-palette-red-{level}`
357
+ - **Use For:** Issues, urgent information
358
+ - **Warning:** Use intentionally and sparingly to avoid confusion with pink (error feedback)
359
+
360
+ ---
361
+
362
+ ## Critical: Dark Mode Support with `light-dark()`
363
+
364
+ ### The `light-dark()` Function
365
+
366
+ **⚠️ IMPORTANT:** Modern SLDS uses the `light-dark()` CSS function to enable automatic dark mode support. Understanding this is critical for proper color usage.
367
+
368
+ #### What is `light-dark()`?
369
+
370
+ The `light-dark()` function automatically selects between two color values based on the user's color scheme preference:
371
+
372
+ ```css
373
+ /* Syntax */
374
+ color: light-dark(<light-mode-color>, <dark-mode-color>);
375
+
376
+ /* Example */
377
+ color: light-dark(#000000, #ffffff);
378
+ /* Light mode: black text */
379
+ /* Dark mode: white text */
380
+ ```
381
+
382
+ #### How SLDS Hooks Use `light-dark()`
383
+
384
+ **Many SLDS hooks internally use `light-dark()` to adapt to themes:**
385
+
386
+ ```css
387
+ /* What you write */
388
+ color: var(--slds-g-color-accent-1);
389
+
390
+ /* What the hook actually contains */
391
+ --slds-g-color-accent-1: light-dark(#066afe, #066afe);
392
+ /* Adapts: blue in light mode, same blue in dark mode */
393
+
394
+ /* Another example */
395
+ --slds-g-color-palette-neutral-10: light-dark(#181818, #f3f3f3);
396
+ /* Adapts: near-black in light mode, near-white in dark mode */
397
+ ```
398
+
399
+ #### Why This Matters
400
+
401
+ **❌ DON'T hard-code colors - breaks dark mode:**
402
+
403
+ ```css
404
+ /* BAD - Hard-coded colors don't adapt */
405
+ .card {
406
+ background: #ffffff; /* Always white - breaks dark mode */
407
+ color: #000000; /* Always black - invisible on dark backgrounds */
408
+ }
409
+
410
+ /* Result in dark mode: White card on dark background = blinding */
411
+ /* Text: Black on black = invisible */
412
+ ```
413
+
414
+ **✅ DO use SLDS hooks - automatic adaptation:**
415
+
416
+ ```css
417
+ /* GOOD - Hooks adapt automatically */
418
+ .card {
419
+ background: var(--slds-g-color-surface-container-1);
420
+ /* Light mode: white background */
421
+ /* Dark mode: dark background */
422
+
423
+ color: var(--slds-g-color-on-surface-2);
424
+ /* Light mode: dark text */
425
+ /* Dark mode: light text */
426
+ }
427
+
428
+ /* Result: Perfect in both modes */
429
+ ```
430
+
431
+ #### When Single Colors Are Dangerous
432
+
433
+ **Single color values assume a specific background:**
434
+
435
+ ```css
436
+ /* DANGEROUS - Assumes light background */
437
+ .text {
438
+ color: #333333; /* Dark gray */
439
+ /* Works in light mode */
440
+ /* FAILS in dark mode - low contrast */
441
+ }
442
+
443
+ /* SAFE - Uses hook with light-dark() */
444
+ .text {
445
+ color: var(--slds-g-color-on-surface-2);
446
+ /* Automatically adapts to background */
447
+ }
448
+ ```
449
+
450
+ #### The Neutral Palette Inversion
451
+
452
+ **Critical Understanding:** Neutral palette colors often INVERT between light and dark modes:
453
+
454
+ ```css
455
+ /* Neutral-10 (near black → near white) */
456
+ --slds-g-color-palette-neutral-10: light-dark(#181818, #f3f3f3);
457
+ /* Light mode: very dark (10 on scale) */
458
+ /* Dark mode: very light (90 on scale) - INVERTED */
459
+
460
+ /* Neutral-95 (near white → near black) */
461
+ --slds-g-color-palette-neutral-95: light-dark(#f3f3f3, #181818);
462
+ /* Light mode: very light (95 on scale) */
463
+ /* Dark mode: very dark (10 on scale) - INVERTED */
464
+ ```
465
+
466
+ **This means:**
467
+
468
+ - Text colors (neutral-10, neutral-20) become light in dark mode
469
+ - Background colors (neutral-95, neutral-100) become dark in dark mode
470
+ - The 50-point separation rule maintains contrast in both modes
471
+
472
+ #### Complete Example: Light/Dark Aware Component
473
+
474
+ ```css
475
+ /* ✅ FULLY DARK MODE COMPATIBLE */
476
+ .card {
477
+ /* Background: white in light mode, dark in dark mode */
478
+ background: var(--slds-g-color-palette-neutral-100);
479
+
480
+ /* Text: dark in light mode, light in dark mode */
481
+ color: var(--slds-g-color-palette-neutral-10);
482
+
483
+ /* Border: mid-gray adapts to theme */
484
+ border: 1px solid var(--slds-g-color-palette-neutral-70);
485
+ }
486
+
487
+ .card-header {
488
+ /* Semantic hook handles dark mode automatically */
489
+ background: var(--slds-g-color-accent-container-1);
490
+ color: var(--slds-g-color-on-accent-1);
491
+ }
492
+
493
+ /* Hover states work in both modes */
494
+ .button {
495
+ background: var(--slds-g-color-palette-brand-50);
496
+ color: var(--slds-g-color-palette-brand-100);
497
+ }
498
+
499
+ .button:hover {
500
+ /* 10-point shift maintains contrast in both modes */
501
+ background: var(--slds-g-color-palette-brand-40);
502
+ }
503
+ ```
504
+
505
+ #### Red Flags for Agents
506
+
507
+ **🚨 Avoid these patterns:**
508
+
509
+ ```css
510
+ /* ❌ Hard-coded hex colors */
511
+ color: #000000;
512
+ background: #ffffff;
513
+
514
+ /* ❌ Hard-coded rgb colors */
515
+ color: rgb(0, 0, 0);
516
+ background: rgb(255, 255, 255);
517
+
518
+ /* ❌ Named colors */
519
+ color: black;
520
+ background: white;
521
+
522
+ /* ❌ Mixing hooks with hard-coded colors */
523
+ background: var(--slds-g-color-surface-1); /* Good */
524
+ color: #333333; /* Bad - won't adapt */
525
+ ```
526
+
527
+ **✅ Safe patterns:**
528
+
529
+ ```css
530
+ /* ✅ SLDS hooks for everything */
531
+ color: var(--slds-g-color-on-surface-2);
532
+ background: var(--slds-g-color-surface-container-1);
533
+
534
+ /* ✅ Palette hooks (they contain light-dark()) */
535
+ color: var(--slds-g-color-palette-neutral-10);
536
+ background: var(--slds-g-color-palette-neutral-95);
537
+
538
+ /* ✅ Semantic hooks (pre-configured for dark mode) */
539
+ background: var(--slds-g-color-accent-container-1);
540
+ color: var(--slds-g-color-on-accent-1);
541
+ ```
542
+
543
+ #### Testing Dark Mode
544
+
545
+ **How to verify your colors work in both modes:**
546
+
547
+ 1. **Use SLDS hooks exclusively** - They handle `light-dark()` internally
548
+ 2. **Test with system dark mode** - Enable OS dark mode to see adaptation
549
+ 3. **Check contrast in both modes** - 50-point rule works in both
550
+ 4. **Never hard-code colors** - Always use hooks
551
+
552
+ #### Exception: When Hard-Coded Colors Are OK
553
+
554
+ **Only use hard-coded colors when:**
555
+
556
+ - Building data visualizations that should look identical in both modes
557
+ - Creating brand assets with specific required colors
558
+ - Logos and images (use as images, not CSS backgrounds)
559
+
560
+ **Even then, consider:**
561
+
562
+ ```css
563
+ /* Better: Use palette for data viz but acknowledge it's fixed */
564
+ .chart-bar {
565
+ fill: var(--slds-g-color-palette-purple-50);
566
+ /* This is immutable - same in light/dark mode */
567
+ /* Ensure surrounding UI adapts even if chart doesn't */
568
+ }
569
+ ```
570
+
571
+ #### Key Takeaways for Agents
572
+
573
+ 1. **Never hard-code colors** - Always use SLDS hooks
574
+ 2. **SLDS hooks contain `light-dark()`** - Automatic adaptation
575
+ 3. **Neutral palette inverts** - neutral-10 ↔ neutral-95 swap in dark mode
576
+ 4. **50-point rule works in both modes** - Contrast maintained automatically
577
+ 5. **Test both modes** - Enable system dark mode to verify
578
+ 6. **Semantic hooks are safest** - Pre-validated for dark mode
579
+
580
+ ---
581
+
582
+ ## When to Use Each Tier
583
+
584
+ ### Decision Tree
585
+
586
+ ```
587
+ 1. Does a SEMANTIC UI COLOR exist for this use case?
588
+ ├─ YES → Use semantic hook (Tier 1)
589
+ │ Examples: --slds-g-color-accent-1, --slds-g-color-surface-1
590
+ └─ NO → Continue to step 2
591
+
592
+ 2. Is this an edge case where a SYSTEM COLOR makes sense?
593
+ ├─ YES → Use system color (Tier 2)
594
+ │ - For brand interactive states: brand-base-*
595
+ │ - For feedback alerts: error-base-*, warning-base-*, success-base-*
596
+ │ - For neutral UI: neutral-base-*
597
+ └─ NO → Continue to step 3
598
+
599
+ 3. Use COLOR PALETTE (Tier 3)
600
+ - For data visualization: expressive palettes (purple, cloud-blue, etc.)
601
+ - For general UI when semantic/system don't fit: palette-neutral-*
602
+ - For custom requirements: any palette color
603
+
604
+ Remember: Follow 50-point rule for text, 40-point for UI elements
605
+ ```
606
+
607
+ ### Use Semantic UI Colors (Tier 1) When:
608
+
609
+ - ✅ Building standard UI components (buttons, cards, inputs)
610
+ - ✅ Interactive elements need theme-aware colors
611
+ - ✅ Want automatic light/dark mode adaptation
612
+ - ✅ Need pre-validated accessible pairings
613
+ - **Available Now:** accent-\* hooks (12 total)
614
+ - **Coming Soon:** surface-_, container-_, feedback-_, on-_ hooks
615
+
616
+ ### Use System Colors (Tier 2) When:
617
+
618
+ - ✅ Semantic UI colors don't make sense for your use case
619
+ - ✅ Need brand-base for interactive states (but accent-\* semantic preferred)
620
+ - ✅ Need feedback colors (error/warning/success) but semantic feedback hooks aren't available
621
+ - ✅ Need neutral colors for edge cases
622
+ - ⚠️ **Important:** These are for edge cases only - prefer semantic when available
623
+
624
+ ### Use Color Palettes (Tier 3) When:
625
+
626
+ - ✅ Data visualization requiring multiple distinct colors
627
+ - ✅ Custom charts and graphs
628
+ - ✅ Neither semantic nor system colors fit your use case
629
+ - ✅ Need granular control over exact color values
630
+ - ✅ Building custom themes or branding
631
+ - ⚠️ **Remember:** You're responsible for accessibility
632
+
633
+ ---
634
+
635
+ ## The 85-5-10 Color Density Rule
636
+
637
+ **Mandatory Distribution:**
638
+
639
+ ### 85% - Foundation Colors (Neutral)
640
+
641
+ ```css
642
+ /* Page backgrounds, surfaces, text, borders, structural elements */
643
+ background: var(--slds-g-color-palette-neutral-95);
644
+ color: var(--slds-g-color-palette-neutral-10);
645
+ border-color: var(--slds-g-color-palette-neutral-70);
646
+ ```
647
+
648
+ **Purpose:** Creates the neutral canvas for all content. Uses whites, light grays, dark grays for contrast.
649
+
650
+ **Allowed Palettes:** Neutral (primary)
651
+
652
+ **Usage:** Page backgrounds, surface layers, neutral containers, text, borders, structural elements
653
+
654
+ ### 5% - Accents (Brand + Feedback)
655
+
656
+ ```css
657
+ /* Primary actions, selected states, status indicators, CTAs */
658
+ background: var(--slds-g-color-accent-container-1);
659
+ background: var(--slds-g-color-palette-brand-50); /* or brand palette */
660
+ background: var(--slds-g-color-palette-pink-95); /* error feedback */
661
+ ```
662
+
663
+ **Purpose:** Strategic emphasis on interactive elements. Reserved for guiding users toward task completion.
664
+
665
+ **Allowed Palettes:** Brand, accent semantic, feedback palettes (pink, yellow, teal, blue)
666
+
667
+ **Usage:** Primary actions, selected states, status indicators, critical CTAs, feedback messages
668
+
669
+ ### 10% - Expressive (Data Viz + Custom)
670
+
671
+ ```css
672
+ /* Data charts, visualization highlights, app-specific accents */
673
+ .chart-series-1 {
674
+ background: var(--slds-g-color-palette-purple-50);
675
+ }
676
+ .chart-series-2 {
677
+ background: var(--slds-g-color-palette-cloud-blue-50);
678
+ }
679
+ .chart-series-3 {
680
+ background: var(--slds-g-color-palette-green-50);
681
+ }
682
+ ```
683
+
684
+ **Purpose:** Extended color options for data visualization and customized app experiences. Use with restraint.
685
+
686
+ **Allowed Palettes:** Green, Cloud Blue, Indigo, Purple, Violet, Red, Hot Orange, Orange
687
+
688
+ **Usage:** Data charts, custom branding, visualization highlights, app-specific accents
689
+
690
+ **Rules:**
691
+
692
+ - **Cool tones first:** Prioritize Cloud Blue, Purple, Indigo, Violet for general designs - integrate better with foundation palette
693
+ - **Indigo warning:** Resembles brand blue - using carelessly breaks button hierarchy
694
+ - **Warm = attention only:** Orange, Red, Green signal importance - reserve for critical information
695
+ - **Prevent feedback confusion:** Expressive colors can be misinterpreted as system feedback
696
+
697
+ ---
698
+
699
+ ## Common Patterns for Agents
700
+
701
+ ### Pattern 1: Page with Card Layout
702
+
703
+ ```css
704
+ /* 85% - Foundation */
705
+ .page {
706
+ background: var(--slds-g-color-palette-neutral-100); /* White */
707
+ }
708
+
709
+ .card {
710
+ background: var(--slds-g-color-palette-neutral-95); /* Light gray */
711
+ border: 1px solid var(--slds-g-color-palette-neutral-70);
712
+ color: var(--slds-g-color-palette-neutral-10);
713
+ }
714
+
715
+ /* 5% - Accent */
716
+ .primary-button {
717
+ background: var(--slds-g-color-accent-container-1); /* If available */
718
+ /* OR */
719
+ background: var(--slds-g-color-palette-brand-50);
720
+ color: var(--slds-g-color-palette-brand-100); /* White on brand */
721
+ }
722
+
723
+ .link {
724
+ color: var(--slds-g-color-palette-brand-30); /* Brand link color */
725
+ }
726
+ ```
727
+
728
+ ### Pattern 2: Form with Validation
729
+
730
+ ```css
731
+ /* Foundation inputs */
732
+ .input {
733
+ background: var(--slds-g-color-palette-neutral-100);
734
+ border: 1px solid var(--slds-g-color-palette-neutral-70);
735
+ color: var(--slds-g-color-palette-neutral-10);
736
+ }
737
+
738
+ /* 5% - Feedback states */
739
+ .input-error {
740
+ border-color: var(--slds-g-color-palette-pink-50);
741
+ background: var(--slds-g-color-palette-pink-95);
742
+ }
743
+
744
+ .error-message {
745
+ color: var(--slds-g-color-palette-pink-10);
746
+ /* 85-point separation from pink-95 background = compliant */
747
+ }
748
+
749
+ .input-success {
750
+ border-color: var(--slds-g-color-palette-teal-50);
751
+ }
752
+ ```
753
+
754
+ ### Pattern 3: Data Visualization Dashboard
755
+
756
+ ```css
757
+ /* 85% - Foundation */
758
+ .dashboard {
759
+ background: var(--slds-g-color-palette-neutral-100);
760
+ }
761
+
762
+ .chart-container {
763
+ background: var(--slds-g-color-palette-neutral-95);
764
+ border: 1px solid var(--slds-g-color-palette-neutral-80);
765
+ }
766
+
767
+ /* 10% - Expressive for data */
768
+ .chart-bar-1 {
769
+ fill: var(--slds-g-color-palette-purple-50);
770
+ }
771
+ .chart-bar-2 {
772
+ fill: var(--slds-g-color-palette-cloud-blue-50);
773
+ }
774
+ .chart-bar-3 {
775
+ fill: var(--slds-g-color-palette-indigo-50);
776
+ }
777
+ .chart-bar-4 {
778
+ fill: var(--slds-g-color-palette-violet-50);
779
+ }
780
+
781
+ /* Labels maintain neutral foundation */
782
+ .chart-label {
783
+ fill: var(--slds-g-color-palette-neutral-20);
784
+ }
785
+ ```
786
+
787
+ ### Pattern 4: Interactive States with Palette
788
+
789
+ ```css
790
+ .custom-button {
791
+ /* Default state - using brand palette */
792
+ background: var(--slds-g-color-palette-brand-50);
793
+ color: var(--slds-g-color-palette-brand-100); /* White */
794
+ border: 1px solid var(--slds-g-color-palette-brand-40);
795
+ }
796
+
797
+ .custom-button:hover {
798
+ /* 10 points darker for hover */
799
+ background: var(--slds-g-color-palette-brand-40);
800
+ border-color: var(--slds-g-color-palette-brand-30);
801
+ }
802
+
803
+ .custom-button:active {
804
+ /* 20 points darker for active */
805
+ background: var(--slds-g-color-palette-brand-30);
806
+ border-color: var(--slds-g-color-palette-brand-20);
807
+ }
808
+
809
+ .custom-button:disabled {
810
+ /* Use neutral for disabled */
811
+ background: var(--slds-g-color-palette-neutral-90);
812
+ color: var(--slds-g-color-palette-neutral-50);
813
+ border-color: var(--slds-g-color-palette-neutral-80);
814
+ }
815
+ ```
816
+
817
+ ---
818
+
819
+ ## Accessibility Best Practices
820
+
821
+ ### Text Contrast (50-Point Rule)
822
+
823
+ ```css
824
+ /* ✅ ALWAYS COMPLIANT */
825
+ .text-light-bg {
826
+ background: var(--slds-g-color-palette-neutral-95);
827
+ color: var(--slds-g-color-palette-neutral-10);
828
+ /* 85-point separation = 7:1+ contrast */
829
+ }
830
+
831
+ .text-dark-bg {
832
+ background: var(--slds-g-color-palette-blue-20);
833
+ color: var(--slds-g-color-palette-blue-75);
834
+ /* 55-point separation = 5:1+ contrast */
835
+ }
836
+
837
+ /* ⚠️ BORDERLINE - Test manually */
838
+ .text-mid-bg {
839
+ background: var(--slds-g-color-palette-neutral-50);
840
+ color: var(--slds-g-color-palette-neutral-100);
841
+ /* Exactly 50-point separation = ~4.5:1 */
842
+ }
843
+ ```
844
+
845
+ ### UI Element Contrast (40-Point Rule)
846
+
847
+ ```css
848
+ /* ✅ COMPLIANT borders and icons */
849
+ .bordered-element {
850
+ background: var(--slds-g-color-palette-neutral-100);
851
+ border: 2px solid var(--slds-g-color-palette-neutral-60);
852
+ /* 40-point separation = 3:1+ contrast */
853
+ }
854
+
855
+ .icon-button {
856
+ background: var(--slds-g-color-palette-neutral-95);
857
+ /* Icon color */
858
+ color: var(--slds-g-color-palette-neutral-40);
859
+ /* 55-point separation = good contrast for icons */
860
+ }
861
+ ```
862
+
863
+ ### Additional Considerations
864
+
865
+ 1. **Don't rely on color alone** - Always pair with icons, labels, or patterns
866
+ 2. **Test with colorblind simulation** - Especially for data visualizations with multiple colors
867
+ 3. **Provide text alternatives** - For charts and visualizations
868
+ 4. **Use semantic colors when possible** - They're pre-validated for accessibility
869
+
870
+ ---
871
+
872
+ ## Troubleshooting for Agents
873
+
874
+ ### Problem: Colors look wrong or don't match designs
875
+
876
+ **Solution:**
877
+
878
+ - Check if you should be using semantic accent hooks instead of palette
879
+ - Verify you're using the correct point level (50 for mid-tone, 10 for dark text, 95 for light backgrounds)
880
+ - Ensure 85-5-10 density rule is maintained
881
+
882
+ ### Problem: Text is hard to read
883
+
884
+ **Solution:**
885
+
886
+ - Verify 50-point separation between text and background
887
+ - Use lower numbers (10-30) for text on light backgrounds
888
+ - Use higher numbers (70-95) for text on dark backgrounds
889
+
890
+ ### Problem: Too much color in the UI
891
+
892
+ **Solution:**
893
+
894
+ - Check 85-5-10 distribution - most UI should be neutral
895
+ - Reserve accent colors for primary actions only
896
+ - Use expressive palettes only for data visualization
897
+
898
+ ### Problem: Interactive states are unclear
899
+
900
+ **Solution:**
901
+
902
+ - Use 10-point steps for state transitions (50 → 40 → 30)
903
+ - Ensure borders also darken with background
904
+ - Consider using semantic accent hooks if available
905
+
906
+ ---
907
+
908
+ ## Summary for Coding Agents
909
+
910
+ **Quick Rules:**
911
+
912
+ 1. **NEVER hard-code colors** - Always use SLDS hooks (they contain `light-dark()`)
913
+ 2. **85% neutral** - Use `neutral-*` palette for foundation
914
+ 3. **5% accent** - Use `accent-*` semantic or `brand-*` palette for actions
915
+ 4. **10% expressive** - Use cool tone palettes for data viz
916
+ 5. **50-point separation** - For text on backgrounds (4.5:1)
917
+ 6. **40-point separation** - For UI elements like borders (3:1)
918
+ 7. **10-point steps** - For interactive state transitions
919
+ 8. **Test dark mode** - Hooks adapt automatically via `light-dark()`
920
+
921
+ **Search for Hooks:**
922
+
923
+ ```javascript
924
+ // Find all palette colors
925
+ {
926
+ {
927
+ EXPLORE_SLDS_STYLING_TOOL;
928
+ }
929
+ }
930
+ ({ prefix: '--slds-g-color-palette-' });
931
+
932
+ // Find specific palette
933
+ {
934
+ {
935
+ EXPLORE_SLDS_STYLING_TOOL;
936
+ }
937
+ }
938
+ ({ search: 'palette-neutral' });
939
+
940
+ // Check specific hook
941
+ {
942
+ {
943
+ EXPLORE_SLDS_STYLING_TOOL;
944
+ }
945
+ }
946
+ ({ hooks: ['--slds-g-color-palette-blue-50'] });
947
+ ```
948
+
949
+ **When in Doubt:**
950
+
951
+ - Use `neutral-95` for backgrounds
952
+ - Use `neutral-10` for text
953
+ - Use `neutral-70` for borders
954
+ - Use semantic `accent-*` hooks when available
955
+ - Test contrast with the magic numbers
956
+
957
+ ---
958
+
959
+ **References:**
960
+
961
+ - [SLDS Color Overview](https://www.lightningdesignsystem.com/2e1ef8501/p/655b28-color)
962
+ - [Accent Hooks Documentation](../global-semantic/accent-hooks.json)
963
+ - [Complete Hooks Index](../metadata/hooks-index.json)