igniteui-cli 14.10.0-alpha.2 → 14.10.0-alpha.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 (27) hide show
  1. package/package.json +4 -4
  2. package/templates/react/igr-ts/projects/_base/files/__dot__claude/skills/igniteui-react-components/SKILL.md +161 -0
  3. package/templates/react/igr-ts/projects/_base/files/__dot__claude/skills/igniteui-react-components/reference/CHARTS-GRIDS.md +127 -0
  4. package/templates/react/igr-ts/projects/_base/files/__dot__claude/skills/igniteui-react-components/reference/COMPONENT-CATALOGUE.md +301 -0
  5. package/templates/react/igr-ts/projects/_base/files/__dot__claude/skills/igniteui-react-components/reference/EVENT-HANDLING.md +70 -0
  6. package/templates/react/igr-ts/projects/_base/files/__dot__claude/skills/igniteui-react-components/reference/INSTALLATION.md +139 -0
  7. package/templates/react/igr-ts/projects/_base/files/__dot__claude/skills/igniteui-react-components/reference/JSX-PATTERNS.md +187 -0
  8. package/templates/react/igr-ts/projects/_base/files/__dot__claude/skills/igniteui-react-components/reference/REFS-FORMS.md +229 -0
  9. package/templates/react/igr-ts/projects/_base/files/__dot__claude/skills/igniteui-react-components/reference/REVEAL-SDK.md +198 -0
  10. package/templates/react/igr-ts/projects/_base/files/__dot__claude/skills/igniteui-react-components/reference/TROUBLESHOOTING.md +147 -0
  11. package/templates/react/igr-ts/projects/_base/files/__dot__claude/skills/igniteui-react-customize-theme/SKILL.md +182 -0
  12. package/templates/react/igr-ts/projects/_base/files/__dot__claude/skills/igniteui-react-customize-theme/reference/CSS-THEMING.md +265 -0
  13. package/templates/react/igr-ts/projects/_base/files/__dot__claude/skills/igniteui-react-customize-theme/reference/MCP-SERVER.md +75 -0
  14. package/templates/react/igr-ts/projects/_base/files/__dot__claude/skills/igniteui-react-customize-theme/reference/REVEAL-THEME.md +86 -0
  15. package/templates/react/igr-ts/projects/_base/files/__dot__claude/skills/igniteui-react-customize-theme/reference/SASS-THEMING.md +125 -0
  16. package/templates/react/igr-ts/projects/_base/files/__dot__claude/skills/igniteui-react-customize-theme/reference/TROUBLESHOOTING.md +35 -0
  17. package/templates/react/igr-ts/projects/_base/files/__dot__claude/skills/igniteui-react-optimize-bundle-size/SKILL.md +439 -0
  18. package/templates/react/igr-ts/projects/_base/files/__dot__vscode/mcp.json +2 -2
  19. package/templates/webcomponents/igc-ts/projects/_base/files/__dot__claude/skills/igniteui-wc-choose-components/SKILL.md +358 -0
  20. package/templates/webcomponents/igc-ts/projects/_base/files/__dot__claude/skills/igniteui-wc-customize-component-theme/SKILL.md +615 -0
  21. package/templates/webcomponents/igc-ts/projects/_base/files/__dot__claude/skills/igniteui-wc-integrate-with-framework/SKILL.md +112 -0
  22. package/templates/webcomponents/igc-ts/projects/_base/files/__dot__claude/skills/igniteui-wc-integrate-with-framework/references/angular.md +185 -0
  23. package/templates/webcomponents/igc-ts/projects/_base/files/__dot__claude/skills/igniteui-wc-integrate-with-framework/references/react.md +116 -0
  24. package/templates/webcomponents/igc-ts/projects/_base/files/__dot__claude/skills/igniteui-wc-integrate-with-framework/references/vanilla-js.md +118 -0
  25. package/templates/webcomponents/igc-ts/projects/_base/files/__dot__claude/skills/igniteui-wc-integrate-with-framework/references/vue.md +181 -0
  26. package/templates/webcomponents/igc-ts/projects/_base/files/__dot__claude/skills/igniteui-wc-optimize-bundle-size/SKILL.md +709 -0
  27. package/templates/webcomponents/igc-ts/projects/_base/files/__dot__vscode/mcp.json +2 -2
@@ -0,0 +1,615 @@
1
+ ---
2
+ name: igniteui-wc-customize-component-theme
3
+ description: Customize Ignite UI Web Components styling using CSS custom properties, optional Sass, and the igniteui-theming MCP server for AI-assisted theming
4
+ user-invocable: true
5
+ ---
6
+
7
+ # Ignite UI Web Components — Theming Skill
8
+
9
+ ## Description
10
+
11
+ This skill teaches AI agents how to theme Ignite UI Web Components (and React via `igniteui-react`) applications. Two approaches are supported:
12
+
13
+ - **CSS custom properties** — works in any project without additional build tooling
14
+ - **Sass** — available when the project has Sass configured; provides the full palette/typography/elevation API
15
+
16
+ The skill also covers component-level theming, layout controls (spacing, sizing, roundness), and how to use the **Ignite UI Theming MCP server** for AI-assisted code generation.
17
+
18
+ ## Prerequisites
19
+
20
+ - A project with `igniteui-webcomponents` (or `igniteui-react`) installed
21
+ - The **Ignite UI Theming MCP server** (`igniteui-theming`) available as a tool provider
22
+ - **Optional**: Sass configured in the project (enables the Sass-based theming API)
23
+
24
+ > **AGENT INSTRUCTION — MCP Server Setup (REQUIRED)**
25
+ >
26
+ > Before using any theming tools, you MUST verify the MCP server is available
27
+ > by calling `detect_platform`. If the tool is not available or the call fails,
28
+ > you MUST automatically configure it by following the setup process steps described below.
29
+ >
30
+ > After writing the file, inform the user that the MCP server has been
31
+ > configured and they may need to reload the editor for the tools to activate.
32
+ > Start the MCP server and wait for that MCP server to start before continuing the theming related work.
33
+ > Do NOT skip this step or ask the user to do it manually.
34
+
35
+ ## Setting Up the Theming MCP Server
36
+
37
+ The Ignite UI Theming MCP server enables AI assistants to generate production-ready theming code. It must be configured in your editor before the theming tools become available.
38
+
39
+ ### VS Code
40
+
41
+ Create or edit `.vscode/mcp.json` in your project:
42
+
43
+ ```json
44
+ {
45
+ "servers": {
46
+ "igniteui-theming": {
47
+ "command": "npx",
48
+ "args": ["-y", "igniteui-theming", "igniteui-theming-mcp"]
49
+ }
50
+ }
51
+ }
52
+ ```
53
+
54
+ This works whether `igniteui-theming` is installed locally in `node_modules` or needs to be pulled from the npm registry — `npx -y` handles both cases.
55
+
56
+ ### Cursor
57
+
58
+ Create or edit `.cursor/mcp.json`:
59
+
60
+ ```json
61
+ {
62
+ "mcpServers": {
63
+ "igniteui-theming": {
64
+ "command": "npx",
65
+ "args": ["-y", "igniteui-theming", "igniteui-theming-mcp"]
66
+ }
67
+ }
68
+ }
69
+ ```
70
+
71
+ ### Claude Desktop
72
+
73
+ Edit the Claude Desktop config file:
74
+ - **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
75
+ - **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
76
+
77
+ ```json
78
+ {
79
+ "mcpServers": {
80
+ "igniteui-theming": {
81
+ "command": "npx",
82
+ "args": ["-y", "igniteui-theming", "igniteui-theming-mcp"]
83
+ }
84
+ }
85
+ }
86
+ ```
87
+
88
+ ### WebStorm / JetBrains IDEs
89
+
90
+ 1. Go to **Settings → Tools → AI Assistant → MCP Servers**
91
+ 2. Click **+ Add MCP Server**
92
+ 3. Set Command to `npx` and Arguments to `igniteui-theming igniteui-theming-mcp`
93
+ 4. Click OK and restart the AI Assistant
94
+
95
+ ### Verifying the Setup
96
+
97
+ After configuring the MCP server, ask your AI assistant:
98
+
99
+ > "Detect which Ignite UI platform my project uses"
100
+
101
+ If the MCP server is running, the `detect_platform` tool will analyze your `package.json` and return the detected platform (e.g., `webcomponents`).
102
+
103
+ ## Theming Architecture
104
+
105
+ The Ignite UI theming system is built on four pillars:
106
+
107
+ | Concept | Purpose |
108
+ |---|---|
109
+ | **Palette** | Color system with primary, secondary, surface, gray, info, success, warn, error families, each with shades 50–900 + accents A100–A700 |
110
+ | **Typography** | Font family, type scale (h1–h6, subtitle, body, button, caption, overline) |
111
+ | **Elevations** | Box-shadow levels 0–24 for visual depth |
112
+ | **Schema** | Per-component recipes mapping palette colors to component tokens |
113
+
114
+ ### Design Systems
115
+
116
+ Four built-in design systems are available:
117
+
118
+ - **Material** (default) — Material Design 3
119
+ - **Bootstrap** — Bootstrap-inspired
120
+ - **Fluent** — Microsoft Fluent Design
121
+ - **Indigo** — Infragistics Indigo Design
122
+
123
+ Each has light and dark variants (e.g., `$light-material-schema`, `$dark-fluent-schema`).
124
+
125
+ ## Pre-built Themes
126
+
127
+ The quickest way to theme an app is to import a pre-built CSS file in your entry point:
128
+
129
+ ```typescript
130
+ import 'igniteui-webcomponents/themes/light/bootstrap.css';
131
+ ```
132
+
133
+ Available pre-built CSS files:
134
+
135
+ | Import path | Theme |
136
+ |---|---|
137
+ | `igniteui-webcomponents/themes/light/bootstrap.css` | Bootstrap Light |
138
+ | `igniteui-webcomponents/themes/dark/bootstrap.css` | Bootstrap Dark |
139
+ | `igniteui-webcomponents/themes/light/material.css` | Material Light |
140
+ | `igniteui-webcomponents/themes/dark/material.css` | Material Dark |
141
+ | `igniteui-webcomponents/themes/light/fluent.css` | Fluent Light |
142
+ | `igniteui-webcomponents/themes/dark/fluent.css` | Fluent Dark |
143
+ | `igniteui-webcomponents/themes/light/indigo.css` | Indigo Light |
144
+ | `igniteui-webcomponents/themes/dark/indigo.css` | Indigo Dark |
145
+
146
+ ## Custom Theme via CSS Custom Properties
147
+
148
+ > No Sass required. Works in any project after importing a pre-built theme.
149
+
150
+ After importing a pre-built theme, override individual design tokens with CSS custom properties on `:root` or a scoped selector:
151
+
152
+ ```css
153
+ :root {
154
+ /* Override palette hue/saturation/lightness channels */
155
+ --ig-primary-h: 211deg;
156
+ --ig-primary-s: 100%;
157
+ --ig-primary-l: 50%;
158
+
159
+ --ig-secondary-h: 33deg;
160
+ --ig-secondary-s: 100%;
161
+ --ig-secondary-l: 50%;
162
+ }
163
+ ```
164
+
165
+ To scope overrides to a specific container:
166
+
167
+ ```css
168
+ .admin-panel {
169
+ --ig-primary-h: 260deg;
170
+ --ig-primary-s: 60%;
171
+ --ig-primary-l: 45%;
172
+ }
173
+ ```
174
+
175
+ For dark mode, either import a dark theme CSS file directly or toggle overrides with a class or media query:
176
+
177
+ ```css
178
+ @media (prefers-color-scheme: dark) {
179
+ :root {
180
+ --ig-surface-h: 0deg;
181
+ --ig-surface-s: 0%;
182
+ --ig-surface-l: 7%;
183
+ }
184
+ }
185
+
186
+ /* Or manually with a class */
187
+ .dark-theme {
188
+ --ig-surface-h: 0deg;
189
+ --ig-surface-s: 0%;
190
+ --ig-surface-l: 7%;
191
+ }
192
+ ```
193
+
194
+ ## Custom Theme via Sass
195
+
196
+ > Requires Sass configured in the project. First check whether the project has a Sass setup (e.g., a `styles.scss` entry file, `sass` in `devDependencies`, or a Vite/webpack Sass plugin).
197
+
198
+ The Sass API for `igniteui-webcomponents` uses `@use 'igniteui-theming'` with individual mixins — **not** the Angular-specific `core()` / `theme()` combined mixins.
199
+
200
+ ```scss
201
+ @use 'igniteui-theming' as *;
202
+
203
+ // 1. Define a palette
204
+ $my-palette: palette(
205
+ $primary: #1976D2,
206
+ $secondary: #FF9800,
207
+ $surface: #FAFAFA
208
+ );
209
+
210
+ // 2. Apply the palette
211
+ @include palette($my-palette);
212
+
213
+ // 3. Optional: Typography
214
+ @include typography($font-family: "'Roboto', sans-serif");
215
+
216
+ // 4. Optional: Elevations
217
+ @include elevations();
218
+
219
+ // 5. Optional: Spacing
220
+ @include spacing();
221
+ ```
222
+
223
+ For dark themes, use a dark surface color and a dark schema:
224
+
225
+ ```scss
226
+ @use 'igniteui-theming' as *;
227
+
228
+ $dark-palette: palette(
229
+ $primary: #90CAF9,
230
+ $secondary: #FFB74D,
231
+ $surface: #121212
232
+ );
233
+
234
+ @include palette($dark-palette, $schema: $dark-material-schema);
235
+ ```
236
+
237
+ To scope a Sass theme to a container:
238
+
239
+ ```scss
240
+ .admin-panel {
241
+ @include palette($admin-palette, $schema: $light-indigo-schema);
242
+ }
243
+ ```
244
+
245
+ ## Component-Level Theming
246
+
247
+ Override individual component appearance using component theme functions and the `tokens` mixin.
248
+
249
+ > **AGENT INSTRUCTION — No Hardcoded Colors (CRITICAL)**
250
+ >
251
+ > Once a palette has been generated (via `palette()` in Sass or `create_palette` / `create_theme` via MCP),
252
+ > **every color reference MUST come from the generated palette tokens** — never hardcode hex/RGB/HSL values.
253
+ >
254
+ > Use `var(--ig-primary-500)`, `var(--ig-secondary-300)`, `var(--ig-surface-500)`, etc. in CSS,
255
+ > or the `get_color` MCP tool to obtain the correct token reference.
256
+ >
257
+ > **WRONG** (hardcoded hex — breaks theme switching, ignores the palette):
258
+ > ```css
259
+ > igc-avatar {
260
+ > --ig-avatar-background: #E91E63; /* ✗ hardcoded */
261
+ > --ig-avatar-color: #FFFFFF; /* ✗ hardcoded */
262
+ > }
263
+ > ```
264
+ >
265
+ > **RIGHT — CSS** (palette token — stays in sync with the theme):
266
+ > ```css
267
+ > igc-avatar {
268
+ > --ig-avatar-background: var(--ig-primary-500);
269
+ > --ig-avatar-color: var(--ig-primary-500-contrast);
270
+ > }
271
+ > ```
272
+ >
273
+ > **RIGHT — Sass** (when Sass is configured):
274
+ > ```scss
275
+ > $custom-avatar: avatar-theme(
276
+ > $schema: $light-material-schema,
277
+ > $background: var(--ig-primary-500),
278
+ > $color: var(--ig-primary-500-contrast)
279
+ > );
280
+ > ```
281
+ >
282
+ > This applies to **all** style code: component themes, custom CSS rules, and inline styles.
283
+ > The only place raw hex values belong is the **initial `palette()` call** that seeds the color system.
284
+ > Everything downstream must reference the palette.
285
+
286
+ ```css
287
+ igc-avatar {
288
+ --ig-avatar-background: var(--ig-primary-500);
289
+ --ig-avatar-color: var(--ig-primary-500-contrast);
290
+ }
291
+ ```
292
+
293
+ When Sass is available, use the component theme function and `tokens` mixin:
294
+
295
+ ```scss
296
+ @use 'igniteui-theming' as *;
297
+
298
+ $custom-avatar: avatar-theme(
299
+ $schema: $light-material-schema,
300
+ $background: var(--ig-primary-500),
301
+ $color: var(--ig-primary-500-contrast)
302
+ );
303
+
304
+ igc-avatar {
305
+ @include tokens($custom-avatar);
306
+ }
307
+ ```
308
+
309
+ ### Discovering Available Tokens
310
+
311
+ Each component has its own set of design tokens (themeable CSS custom properties). Before theming a component, you must know which tokens exist. Use the **MCP tool** `get_component_design_tokens` to discover them.
312
+
313
+ ### Compound Components
314
+
315
+ Some components (e.g., `combo`, `grid`, `date-picker`, `select`) are **compound** — they contain internal child components, each requiring their own theme. For example, `date-picker` uses `calendar`, `flat-button`, and `input-group` internally.
316
+
317
+ Workflow for compound components:
318
+ 1. Call `get_component_design_tokens` for the parent (e.g., `date-picker`)
319
+ 2. The response lists related themes and scope selectors
320
+ 3. Call `create_component_theme` for each child, using the parent's selector as the wrapper
321
+
322
+ ## Layout Controls
323
+
324
+ ### Sizing
325
+
326
+ Controls the size of components via `--ig-size` (values: 1 = small, 2 = medium, 3 = large):
327
+
328
+ ```css
329
+ /* Global */
330
+ :root { --ig-size: 2; }
331
+
332
+ /* Component-scoped */
333
+ igc-grid { --ig-size: 1; }
334
+ ```
335
+
336
+ ### Spacing
337
+
338
+ Controls internal padding via `--ig-spacing` (1 = default, 0.5 = compact, 2 = spacious):
339
+
340
+ ```css
341
+ :root { --ig-spacing: 1; }
342
+ .compact-section { --ig-spacing: 0.75; }
343
+ ```
344
+
345
+ ### Roundness
346
+
347
+ Controls border-radius via `--ig-radius-factor` (0 = square, 1 = maximum radius):
348
+
349
+ ```css
350
+ :root { --ig-radius-factor: 1; }
351
+ igc-avatar { --ig-radius-factor: 0.5; }
352
+ ```
353
+
354
+ ## Using the Theming MCP Server
355
+
356
+ The Ignite UI Theming MCP server provides tools for AI-assisted theme code generation.
357
+
358
+ > **IMPORTANT — File Safety Rule**: When generating or updating theme code, **never overwrite existing style files directly**. Instead, always **propose the changes as an update** and let the user review and approve before writing to disk. If a `styles.scss` (or any target file) already exists, show the generated code as a diff or suggestion rather than replacing the file contents. This prevents accidental loss of custom styles the user has already written.
359
+
360
+ Always follow this workflow:
361
+
362
+ ### Step 1 — Detect Platform
363
+
364
+ ```
365
+ Tool: detect_platform
366
+ ```
367
+ This auto-detects `webcomponents` from `package.json` and sets the correct import paths.
368
+
369
+ ### Step 2 — Generate a Full Theme
370
+
371
+ ```
372
+ Tool: create_theme
373
+ Params: {
374
+ platform: "webcomponents",
375
+ designSystem: "material",
376
+ primaryColor: "#1976D2",
377
+ secondaryColor: "#FF9800",
378
+ surfaceColor: "#FAFAFA",
379
+ variant: "light",
380
+ fontFamily: "'Roboto', sans-serif",
381
+ includeTypography: true,
382
+ includeElevations: true
383
+ }
384
+ ```
385
+
386
+ Generates a complete Sass file with palette, typography, elevations, and the `theme()` mixin call.
387
+
388
+ ### Step 3 — Customize Individual Components
389
+
390
+ ```
391
+ Tool: get_component_design_tokens
392
+ Params: { component: "grid" }
393
+ ```
394
+
395
+ Then use **palette token references** (not hardcoded hex values) for every color:
396
+
397
+ ```
398
+ Tool: create_component_theme
399
+ Params: {
400
+ platform: "webcomponents",
401
+ designSystem: "material",
402
+ variant: "light",
403
+ component: "grid",
404
+ tokens: {
405
+ "header-background": "var(--ig-primary-50)",
406
+ "header-text-color": "var(--ig-primary-800)"
407
+ }
408
+ }
409
+ ```
410
+
411
+ > **Reminder**: After a palette is generated, all token values passed to
412
+ > `create_component_theme` must reference palette CSS custom properties
413
+ > (e.g., `var(--ig-primary-500)`, `var(--ig-secondary-A200)`,
414
+ > `var(--ig-gray-100)`). Never pass raw hex values like `"#E3F2FD"`.
415
+
416
+ ### Step 4 — Generate a Palette
417
+
418
+ For simple mid-luminance base colors:
419
+
420
+ ```
421
+ Tool: create_palette
422
+ Params: {
423
+ platform: "webcomponents",
424
+ primary: "#1976D2",
425
+ secondary: "#FF9800",
426
+ surface: "#FAFAFA",
427
+ variant: "light"
428
+ }
429
+ ```
430
+
431
+ For brand-specific exact shade values, use `create_custom_palette` with `mode: "explicit"` for full control over each shade.
432
+
433
+ ### Step 5 — Adjust Layout
434
+
435
+ By default, layout tools emit **CSS**. If the project has Sass configured, add `output: "sass"` to get Sass output:
436
+
437
+ ```
438
+ Tool: set_size → { size: "medium" } # CSS (default)
439
+ Tool: set_size → { size: "medium", output: "sass" } # Sass
440
+ Tool: set_spacing → { spacing: 0.75, component: "grid" } # CSS (default)
441
+ Tool: set_spacing → { spacing: 0.75, component: "grid", output: "sass" } # Sass
442
+ Tool: set_roundness → { radiusFactor: 0.8 } # CSS (default)
443
+ Tool: set_roundness → { radiusFactor: 0.8, output: "sass" } # Sass
444
+ ```
445
+
446
+ ### Step 6 — Reference Palette Colors (MANDATORY for All Color Usage)
447
+
448
+ After a palette is generated, **always** use the `get_color` tool to obtain the correct CSS custom property reference. Never hardcode hex/RGB/HSL values in component themes, custom CSS, or Sass variables.
449
+
450
+ ```
451
+ Tool: get_color
452
+ Params: { color: "primary", variant: "600" }
453
+ → var(--ig-primary-600)
454
+
455
+ Params: { color: "primary", variant: "600", contrast: true }
456
+ → var(--ig-primary-600-contrast)
457
+
458
+ Params: { color: "primary", opacity: 0.5 }
459
+ → hsl(from var(--ig-primary-500) h s l / 0.5)
460
+ ```
461
+
462
+ Use these token references everywhere:
463
+ - Component theme `tokens` values
464
+ - Custom CSS rules (`color`, `background`, `border-color`, `fill`, `stroke`, etc.)
465
+
466
+ The **only** place raw hex values are acceptable is in the initial `palette()` call or the `create_palette` / `create_theme` MCP tool inputs that seed the color system.
467
+
468
+ ### Loading Reference Data
469
+
470
+ Use `read_resource` with these URIs for preset values and documentation:
471
+
472
+ | URI | Content |
473
+ |---|---|
474
+ | `theming://presets/palettes` | Preset palette colors |
475
+ | `theming://presets/typography` | Typography presets |
476
+ | `theming://presets/elevations` | Elevation shadow presets |
477
+ | `theming://guidance/colors/usage` | Which shades for which purpose |
478
+ | `theming://guidance/colors/roles` | Semantic color roles |
479
+ | `theming://guidance/colors/rules` | Light/dark theme rules |
480
+ | `theming://platforms/webcomponents` | Web Components platform specifics |
481
+ | `theming://platforms` | All supported platforms |
482
+
483
+ ## Referencing Colors in Custom Styles
484
+
485
+ After a theme is applied, the palette is available as CSS custom properties on `:root`. Use these tokens in all custom CSS — never introduce standalone hex/RGB variables for colors that the palette already provides.
486
+
487
+ ### Correct: Palette Tokens
488
+
489
+ ```css
490
+ /* All colors come from the theme — respects palette changes and dark/light switching */
491
+ .sidebar {
492
+ background: var(--ig-surface-500);
493
+ color: var(--ig-gray-900);
494
+ border-right: 1px solid var(--ig-gray-200);
495
+ }
496
+
497
+ .accent-badge {
498
+ background: var(--ig-secondary-500);
499
+ color: var(--ig-secondary-500-contrast);
500
+ }
501
+
502
+ .hero-section {
503
+ /* Semi-transparent primary overlay */
504
+ background: hsl(from var(--ig-primary-500) h s l / 0.12);
505
+ }
506
+ ```
507
+
508
+ ### Incorrect: Hardcoded Values
509
+
510
+ ```css
511
+ /* WRONG — these break when the palette changes and ignore dark/light mode */
512
+ .sidebar {
513
+ background: #F0F5FA; /* ✗ not a palette token */
514
+ color: #333; /* ✗ not a palette token */
515
+ }
516
+ ```
517
+
518
+ ### When Raw Hex Values Are OK
519
+
520
+ Raw hex values are acceptable **only** in these contexts:
521
+
522
+ 1. **`palette()` call** — the initial seed colors that generate the full palette
523
+ 2. **`create_palette` / `create_theme` MCP tool inputs** — the base colors passed to the tool
524
+ 3. **Non-palette decorative values** — e.g., a one-off SVG illustration color that intentionally stays fixed regardless of theme
525
+
526
+ Everything else must use `var(--ig-<family>-<shade>)` tokens.
527
+
528
+ ## Common Patterns
529
+
530
+ ### Switching Between Light and Dark Themes — CSS approach
531
+
532
+ Import the appropriate theme CSS and toggle with a class or media query:
533
+
534
+ ```typescript
535
+ // In your entry point — choose one variant as the default
536
+ import 'igniteui-webcomponents/themes/light/bootstrap.css';
537
+ ```
538
+
539
+ ```css
540
+ /* Override surface tokens for dark mode */
541
+ .dark-theme {
542
+ --ig-surface-h: 0deg;
543
+ --ig-surface-s: 0%;
544
+ --ig-surface-l: 7%;
545
+ }
546
+
547
+ @media (prefers-color-scheme: dark) {
548
+ :root {
549
+ --ig-surface-h: 0deg;
550
+ --ig-surface-s: 0%;
551
+ --ig-surface-l: 7%;
552
+ }
553
+ }
554
+ ```
555
+
556
+ Or dynamically swap the stylesheet at runtime:
557
+
558
+ ```typescript
559
+ function setTheme(variant: 'light' | 'dark', design = 'bootstrap') {
560
+ const link = document.getElementById('igc-theme') as HTMLLinkElement;
561
+ link.href = `node_modules/igniteui-webcomponents/themes/${variant}/${design}.css`;
562
+ }
563
+ ```
564
+
565
+ ### Switching Between Light and Dark Themes — Sass approach
566
+
567
+ When Sass is configured, define both palettes and apply them under separate selectors:
568
+
569
+ ```scss
570
+ @use 'igniteui-theming' as *;
571
+
572
+ $light-palette: palette($primary: #1976D2, $secondary: #FF9800, $surface: #FAFAFA);
573
+ $dark-palette: palette($primary: #90CAF9, $secondary: #FFB74D, $surface: #121212);
574
+
575
+ @include typography($font-family: "'Roboto', sans-serif");
576
+ @include elevations();
577
+
578
+ // Light is default
579
+ @include palette($light-palette, $schema: $light-material-schema);
580
+
581
+ // Dark via class on <body> or <html>
582
+ .dark-theme {
583
+ @include palette($dark-palette, $schema: $dark-material-schema);
584
+ }
585
+ ```
586
+
587
+ ### Scoping a Theme to a Container — CSS approach
588
+
589
+ ```css
590
+ .admin-panel {
591
+ --ig-primary-h: 260deg;
592
+ --ig-primary-s: 60%;
593
+ --ig-primary-l: 45%;
594
+ }
595
+ ```
596
+
597
+ ### Scoping a Theme to a Container — Sass approach
598
+
599
+ ```scss
600
+ .admin-panel {
601
+ @include palette($admin-palette, $schema: $light-indigo-schema);
602
+ }
603
+ ```
604
+
605
+ ## Key Rules
606
+
607
+ 1. **Never overwrite existing files directly** — always propose theme code as an update for user review; do not replace existing style files without confirmation
608
+ 2. **Always call `detect_platform` first** when using MCP tools
609
+ 3. **Always call `get_component_design_tokens` before `create_component_theme`** to discover valid token names
610
+ 4. **Palette shades 50 = lightest, 900 = darkest** for all chromatic colors — never invert for dark themes (only gray inverts)
611
+ 5. **Surface color must match the variant** — light color for `light`, dark color for `dark`
612
+ 6. **Sass only**: Use `@include palette()`, `@include typography()`, and `@include elevations()` individually — `@use 'igniteui-theming'` is the correct module for web components and React (not `igniteui-angular/theming`); the Angular-specific `core()` / `theme()` combined mixins do **not** apply here
613
+ 7. **Sass only**: Component themes use `@include tokens($theme)` inside a selector to emit CSS custom properties
614
+ 8. **For compound components**, follow the full checklist returned by `get_component_design_tokens` — theme each child component with its scoped selector
615
+ 9. **Never hardcode colors after palette generation** — once a palette is created, every color in component themes, custom CSS, and Sass variables must use `var(--ig-<family>-<shade>)` palette tokens (e.g., `var(--ig-primary-500)`, `var(--ig-gray-200)`). Raw hex/RGB/HSL values are only acceptable in the initial `palette()` seed call. This ensures themes remain consistent, switchable (light/dark), and maintainable