@rxap/ngx-theme 19.1.0-dev.0 → 19.1.0-dev.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.
Files changed (81) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +1 -1
  3. package/compodoc/changelog.html +5 -0
  4. package/compodoc/classes/ThemeColor.html +874 -0
  5. package/compodoc/dependencies.html +3 -1
  6. package/compodoc/index.html +1 -1
  7. package/compodoc/interfaces/BasePalette.html +844 -0
  8. package/compodoc/interfaces/ThemeColors.html +898 -0
  9. package/compodoc/js/menu-wc.js +19 -0
  10. package/compodoc/js/menu-wc_es5.js +1 -1
  11. package/compodoc/js/search/search_index.js +2 -2
  12. package/compodoc/miscellaneous/functions.html +60 -1
  13. package/compodoc/miscellaneous/typealiases.html +129 -0
  14. package/compodoc/miscellaneous/variables.html +161 -0
  15. package/compodoc/overview.html +9 -1
  16. package/compodoc/properties.html +1 -1
  17. package/docs/documentation.json +1088 -464
  18. package/docs/html/assets/hierarchy.js +1 -1
  19. package/docs/html/assets/navigation.js +1 -1
  20. package/docs/html/assets/search.js +1 -1
  21. package/docs/html/classes/ThemeColor.html +4 -0
  22. package/docs/html/classes/ThemeModeService.html +6 -6
  23. package/docs/html/classes/ThemeService.html +2 -2
  24. package/docs/html/enums/ColorPaletteAlgorithm.html +2 -2
  25. package/docs/html/functions/ComputeColorPalette.html +1 -1
  26. package/docs/html/functions/ObserveCurrentThemeDensity.html +1 -1
  27. package/docs/html/functions/applyThemeColorBootstrapHook.html +1 -0
  28. package/docs/html/functions/provideTheme.html +1 -1
  29. package/docs/html/hierarchy.html +1 -1
  30. package/docs/html/index.html +3 -3
  31. package/docs/html/interfaces/ColorPalette.html +2 -2
  32. package/docs/html/interfaces/ColorPaletteConfig.html +2 -2
  33. package/docs/html/interfaces/ColorPaletteConfigWithName.html +2 -2
  34. package/docs/html/interfaces/ThemeColors.html +7 -0
  35. package/docs/html/interfaces/ThemeConfig.html +2 -2
  36. package/docs/html/modules.html +1 -1
  37. package/docs/html/types/ActiveTheme.html +1 -1
  38. package/docs/html/types/ThemeSetting.html +1 -1
  39. package/docs/html/variables/THEME_SETTING_KEY.html +1 -1
  40. package/docs/markdown/README.md +2 -2
  41. package/docs/markdown/classes/ThemeColor.md +83 -0
  42. package/docs/markdown/classes/ThemeModeService.md +22 -22
  43. package/docs/markdown/classes/ThemeService.md +31 -31
  44. package/docs/markdown/enumerations/ColorPaletteAlgorithm.md +4 -4
  45. package/docs/markdown/functions/ComputeColorPalette.md +2 -2
  46. package/docs/markdown/functions/ObserveCurrentThemeDensity.md +2 -2
  47. package/docs/markdown/functions/applyThemeColorBootstrapHook.md +31 -0
  48. package/docs/markdown/functions/provideTheme.md +2 -2
  49. package/docs/markdown/globals.md +5 -2
  50. package/docs/markdown/interfaces/ColorPalette.md +16 -16
  51. package/docs/markdown/interfaces/ColorPaletteConfig.md +5 -5
  52. package/docs/markdown/interfaces/ColorPaletteConfigWithName.md +6 -6
  53. package/docs/markdown/interfaces/ThemeColors.md +57 -0
  54. package/docs/markdown/interfaces/ThemeConfig.md +7 -7
  55. package/docs/markdown/type-aliases/ActiveTheme.md +2 -2
  56. package/docs/markdown/type-aliases/ThemeSetting.md +2 -2
  57. package/docs/markdown/variables/THEME_SETTING_KEY.md +2 -2
  58. package/docs/wiki/Class.ThemeColor.md +79 -0
  59. package/docs/wiki/Class.ThemeModeService.md +21 -21
  60. package/docs/wiki/Class.ThemeService.md +30 -30
  61. package/docs/wiki/Enumeration.ColorPaletteAlgorithm.md +3 -3
  62. package/docs/wiki/Function.ComputeColorPalette.md +1 -1
  63. package/docs/wiki/Function.ObserveCurrentThemeDensity.md +1 -1
  64. package/docs/wiki/Function.applyThemeColorBootstrapHook.md +27 -0
  65. package/docs/wiki/Function.provideTheme.md +1 -1
  66. package/docs/wiki/Home.md +1 -1
  67. package/docs/wiki/Interface.ColorPalette.md +15 -15
  68. package/docs/wiki/Interface.ColorPaletteConfig.md +4 -4
  69. package/docs/wiki/Interface.ColorPaletteConfigWithName.md +5 -5
  70. package/docs/wiki/Interface.ThemeColors.md +53 -0
  71. package/docs/wiki/Interface.ThemeConfig.md +6 -6
  72. package/docs/wiki/TypeAlias.ActiveTheme.md +1 -1
  73. package/docs/wiki/TypeAlias.ThemeSetting.md +1 -1
  74. package/docs/wiki/Variable.THEME_SETTING_KEY.md +1 -1
  75. package/docs/wiki/_Sidebar.md +3 -0
  76. package/docs/wiki/globals.md +4 -1
  77. package/fesm2022/rxap-ngx-theme.mjs +251 -1
  78. package/fesm2022/rxap-ngx-theme.mjs.map +1 -1
  79. package/index.d.ts +1 -0
  80. package/lib/theme-color.d.ts +29 -0
  81. package/package.json +5 -4
@@ -0,0 +1,844 @@
1
+ <!doctype html>
2
+ <html class="no-js" lang="">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta http-equiv="x-ua-compatible" content="ie=edge">
6
+ <title>angular-theme</title>
7
+ <meta name="description" content="">
8
+ <meta name="viewport" content="width=device-width, initial-scale=1">
9
+
10
+ <link rel="icon" type="image/x-icon" href="../images/favicon.ico">
11
+ <link rel="stylesheet" href="../styles/style.css">
12
+ <link rel="stylesheet" href="../styles/dark.css">
13
+ </head>
14
+ <body>
15
+ <script>
16
+ // Blocking script to avoid flickering dark mode
17
+ // Dark mode toggle button
18
+ var useDark = window.matchMedia('(prefers-color-scheme: dark)');
19
+ var darkModeState = useDark.matches;
20
+ var $darkModeToggleSwitchers = document.querySelectorAll('.dark-mode-switch input');
21
+ var $darkModeToggles = document.querySelectorAll('.dark-mode-switch');
22
+ var darkModeStateLocal = localStorage.getItem('compodoc_darkmode-state');
23
+
24
+ function checkToggle(check) {
25
+ for (var i = 0; i < $darkModeToggleSwitchers.length; i++) {
26
+ $darkModeToggleSwitchers[i].checked = check;
27
+ }
28
+ }
29
+
30
+ function toggleDarkMode(state) {
31
+ if (window.localStorage) {
32
+ localStorage.setItem('compodoc_darkmode-state', state);
33
+ }
34
+
35
+ checkToggle(state);
36
+
37
+ const hasClass = document.body.classList.contains('dark');
38
+
39
+ if (state) {
40
+ for (var i = 0; i < $darkModeToggles.length; i++) {
41
+ $darkModeToggles[i].classList.add('dark');
42
+ }
43
+ if (!hasClass) {
44
+ document.body.classList.add('dark');
45
+ }
46
+ } else {
47
+ for (var i = 0; i < $darkModeToggles.length; i++) {
48
+ $darkModeToggles[i].classList.remove('dark');
49
+ }
50
+ if (hasClass) {
51
+ document.body.classList.remove('dark');
52
+ }
53
+ }
54
+ }
55
+
56
+ useDark.addEventListener('change', function (evt) {
57
+ toggleDarkMode(evt.matches);
58
+ });
59
+ if (darkModeStateLocal) {
60
+ darkModeState = darkModeStateLocal === 'true';
61
+ }
62
+ toggleDarkMode(darkModeState);
63
+ </script>
64
+
65
+ <div class="navbar navbar-default navbar-fixed-top d-md-none p-0">
66
+ <div class="d-flex">
67
+ <a href="../" class="navbar-brand">angular-theme</a>
68
+ <button type="button" class="btn btn-default btn-menu ion-ios-menu" id="btn-menu"></button>
69
+ </div>
70
+ </div>
71
+
72
+ <div class="xs-menu menu" id="mobile-menu">
73
+ <div id="book-search-input" role="search"><input type="text" placeholder="Type to search"></div> <compodoc-menu></compodoc-menu>
74
+ </div>
75
+
76
+ <div class="container-fluid main">
77
+ <div class="row main">
78
+ <div class="d-none d-md-block menu">
79
+ <compodoc-menu mode="normal"></compodoc-menu>
80
+ </div>
81
+ <!-- START CONTENT -->
82
+ <div class="content interface">
83
+ <div class="content-data">
84
+
85
+
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+
97
+ <ol class="breadcrumb">
98
+ <li class="breadcrumb-item">Interfaces</li>
99
+ <li class="breadcrumb-item"
100
+ >
101
+ BasePalette</li>
102
+ </ol>
103
+
104
+ <ul class="nav nav-tabs" role="tablist">
105
+ <li class="nav-item">
106
+ <a href="#info"
107
+ class="nav-link"
108
+ class="nav-link active"
109
+ role="tab" id="info-tab" data-bs-toggle="tab" data-link="info">Info</a>
110
+ </li>
111
+ <li class="nav-item">
112
+ <a href="#source"
113
+ class="nav-link"
114
+
115
+ role="tab" id="source-tab" data-bs-toggle="tab" data-link="source">Source</a>
116
+ </li>
117
+ </ul>
118
+
119
+ <div class="tab-content">
120
+ <div class="tab-pane fade active in" id="info">
121
+ <p class="comment">
122
+ <h3>File</h3>
123
+ </p>
124
+ <p class="comment">
125
+ <code>src/lib/theme-color.ts</code>
126
+ </p>
127
+
128
+
129
+ <p class="comment">
130
+ <h3>Description</h3>
131
+ </p>
132
+ <p class="comment">
133
+ <p>Represents the full structure of a Material Design base palette,
134
+ including primary tones and nested palettes for secondary, neutral,
135
+ neutral-variant, and error colors.</p>
136
+
137
+ </p>
138
+
139
+ <p class="comment">
140
+ <h3>Extends</h3>
141
+ </p>
142
+ <p class="comment">
143
+ <code><a href="../miscellaneous/typealiases.html#TonePalette" target="_self" >TonePalette</a></code>
144
+ </p>
145
+
146
+ <section data-compodoc="block-index">
147
+ <h3 id="index">Index</h3>
148
+ <table class="table table-sm table-bordered index-table">
149
+ <tbody>
150
+ <tr>
151
+ <td class="col-md-4">
152
+ <h6><b>Properties</b></h6>
153
+ </td>
154
+ </tr>
155
+ <tr>
156
+ <td class="col-md-4">
157
+ <ul class="index-list">
158
+ <li>
159
+ <a href="#error"
160
+ >
161
+ error
162
+ </a>
163
+ </li>
164
+ <li>
165
+ <a href="#neutral"
166
+ >
167
+ neutral
168
+ </a>
169
+ </li>
170
+ <li>
171
+ <a href="#neutralVariant"
172
+ >
173
+ neutralVariant
174
+ </a>
175
+ </li>
176
+ <li>
177
+ <a href="#secondary"
178
+ >
179
+ secondary
180
+ </a>
181
+ </li>
182
+ <li>
183
+ <a href="#tertiary"
184
+ >
185
+ tertiary
186
+ </a>
187
+ </li>
188
+ </ul>
189
+ </td>
190
+ </tr>
191
+ </tbody>
192
+ </table>
193
+ </section>
194
+
195
+
196
+
197
+ <section data-compodoc="block-properties">
198
+ <h3 id="inputs">Properties</h3>
199
+ <table class="table table-sm table-bordered">
200
+ <tbody>
201
+ <tr>
202
+ <td class="col-md-4">
203
+ <a name="error"></a>
204
+ <span class="name "><b>error</b>
205
+ <a href="#error">
206
+ <span class="icon ion-ios-link"></span>
207
+ </a>
208
+ </span>
209
+ </td>
210
+ </tr>
211
+ <tr>
212
+ <td class="col-md-4">
213
+ <code>error: <code><a href="../miscellaneous/typealiases.html#TonePalette" target="_self" >TonePalette</a></code>
214
+ </code>
215
+ </td>
216
+ </tr>
217
+
218
+
219
+ <tr>
220
+ <td class="col-md-4">
221
+ <i>Type : </i> <code><a href="../miscellaneous/typealiases.html#TonePalette" target="_self" >TonePalette</a></code>
222
+
223
+ </td>
224
+ </tr>
225
+
226
+
227
+
228
+
229
+
230
+ </tbody>
231
+ </table>
232
+ <table class="table table-sm table-bordered">
233
+ <tbody>
234
+ <tr>
235
+ <td class="col-md-4">
236
+ <a name="neutral"></a>
237
+ <span class="name "><b>neutral</b>
238
+ <a href="#neutral">
239
+ <span class="icon ion-ios-link"></span>
240
+ </a>
241
+ </span>
242
+ </td>
243
+ </tr>
244
+ <tr>
245
+ <td class="col-md-4">
246
+ <code>neutral: <code><a href="../miscellaneous/typealiases.html#TonePalette" target="_self" >TonePalette</a></code>
247
+ </code>
248
+ </td>
249
+ </tr>
250
+
251
+
252
+ <tr>
253
+ <td class="col-md-4">
254
+ <i>Type : </i> <code><a href="../miscellaneous/typealiases.html#TonePalette" target="_self" >TonePalette</a></code>
255
+
256
+ </td>
257
+ </tr>
258
+
259
+
260
+
261
+
262
+
263
+ </tbody>
264
+ </table>
265
+ <table class="table table-sm table-bordered">
266
+ <tbody>
267
+ <tr>
268
+ <td class="col-md-4">
269
+ <a name="neutralVariant"></a>
270
+ <span class="name "><b>neutralVariant</b>
271
+ <a href="#neutralVariant">
272
+ <span class="icon ion-ios-link"></span>
273
+ </a>
274
+ </span>
275
+ </td>
276
+ </tr>
277
+ <tr>
278
+ <td class="col-md-4">
279
+ <code>neutralVariant: <code><a href="../miscellaneous/typealiases.html#TonePalette" target="_self" >TonePalette</a></code>
280
+ </code>
281
+ </td>
282
+ </tr>
283
+
284
+
285
+ <tr>
286
+ <td class="col-md-4">
287
+ <i>Type : </i> <code><a href="../miscellaneous/typealiases.html#TonePalette" target="_self" >TonePalette</a></code>
288
+
289
+ </td>
290
+ </tr>
291
+
292
+
293
+
294
+
295
+
296
+ </tbody>
297
+ </table>
298
+ <table class="table table-sm table-bordered">
299
+ <tbody>
300
+ <tr>
301
+ <td class="col-md-4">
302
+ <a name="secondary"></a>
303
+ <span class="name "><b>secondary</b>
304
+ <a href="#secondary">
305
+ <span class="icon ion-ios-link"></span>
306
+ </a>
307
+ </span>
308
+ </td>
309
+ </tr>
310
+ <tr>
311
+ <td class="col-md-4">
312
+ <code>secondary: <code><a href="../miscellaneous/typealiases.html#TonePalette" target="_self" >TonePalette</a></code>
313
+ </code>
314
+ </td>
315
+ </tr>
316
+
317
+
318
+ <tr>
319
+ <td class="col-md-4">
320
+ <i>Type : </i> <code><a href="../miscellaneous/typealiases.html#TonePalette" target="_self" >TonePalette</a></code>
321
+
322
+ </td>
323
+ </tr>
324
+
325
+
326
+
327
+
328
+
329
+ </tbody>
330
+ </table>
331
+ <table class="table table-sm table-bordered">
332
+ <tbody>
333
+ <tr>
334
+ <td class="col-md-4">
335
+ <a name="tertiary"></a>
336
+ <span class="name "><b>tertiary</b>
337
+ <a href="#tertiary">
338
+ <span class="icon ion-ios-link"></span>
339
+ </a>
340
+ </span>
341
+ </td>
342
+ </tr>
343
+ <tr>
344
+ <td class="col-md-4">
345
+ <code>tertiary: <code><a href="../miscellaneous/typealiases.html#TonePalette" target="_self" >TonePalette</a></code>
346
+ </code>
347
+ </td>
348
+ </tr>
349
+
350
+
351
+ <tr>
352
+ <td class="col-md-4">
353
+ <i>Type : </i> <code><a href="../miscellaneous/typealiases.html#TonePalette" target="_self" >TonePalette</a></code>
354
+
355
+ </td>
356
+ </tr>
357
+
358
+
359
+
360
+
361
+
362
+ </tbody>
363
+ </table>
364
+ </section>
365
+ </div>
366
+
367
+
368
+ <div class="tab-pane fade tab-source-code" id="source">
369
+ <pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">import {
370
+ CorePalette,
371
+ TonalPalette
372
+ } from &#x27;@material/material-color-utilities&#x27;;
373
+ import { ConfigService } from &#x27;@rxap/config&#x27;;
374
+
375
+ /**
376
+ * Represents the tone scale numbers used in Material Design palettes.
377
+ * Includes standard tones and specific neutral tones used for surfaces.
378
+ */
379
+ type Tone &#x3D;
380
+ | 0
381
+ | 4
382
+ | 6
383
+ | 10
384
+ | 12
385
+ | 17
386
+ | 20
387
+ | 22
388
+ | 24
389
+ | 25
390
+ | 30
391
+ | 35
392
+ | 40
393
+ | 50
394
+ | 60
395
+ | 70
396
+ | 80
397
+ | 87
398
+ | 90
399
+ | 92
400
+ | 94
401
+ | 95
402
+ | 96
403
+ | 98
404
+ | 99
405
+ | 100;
406
+
407
+ /**
408
+ * Represents a color value, typically a hex string.
409
+ */
410
+ type ColorValue &#x3D; string;
411
+
412
+ /**
413
+ * Represents a palette mapping tones to color values.
414
+ */
415
+ type TonePalette &#x3D; Partial&lt;Record&lt;Tone, ColorValue&gt;&gt;;
416
+
417
+ /**
418
+ * Represents the full structure of a Material Design base palette,
419
+ * including primary tones and nested palettes for secondary, neutral,
420
+ * neutral-variant, and error colors.
421
+ */
422
+ interface BasePalette extends TonePalette {
423
+ secondary: TonePalette;
424
+ tertiary: TonePalette;
425
+ neutral: TonePalette;
426
+ neutralVariant: TonePalette;
427
+ error: TonePalette;
428
+ }
429
+
430
+ /**
431
+ * Defines the possible theme types.
432
+ */
433
+ type ThemeType &#x3D; &#x27;light&#x27; | &#x27;dark&#x27;;
434
+
435
+ /**
436
+ * Represents the output map of CSS variable names to their color values.
437
+ * e.g., { &#x27;--mat-sys-primary&#x27;: &#x27;#6750A4&#x27;, ... }
438
+ */
439
+ type CssVariables &#x3D; Record&lt;string, ColorValue&gt;;
440
+
441
+ // --- Mappings from System Roles to Reference Palette Keys ---
442
+
443
+ const lightRoleToRefKeyMap: Record&lt;string, string&gt; &#x3D; {
444
+ background: &#x27;neutral98&#x27;,
445
+ error: &#x27;error40&#x27;,
446
+ &#x27;error-container&#x27;: &#x27;error90&#x27;,
447
+ &#x27;inverse-on-surface&#x27;: &#x27;neutral95&#x27;,
448
+ &#x27;inverse-primary&#x27;: &#x27;primary80&#x27;,
449
+ &#x27;inverse-surface&#x27;: &#x27;neutral20&#x27;,
450
+ &#x27;on-background&#x27;: &#x27;neutral10&#x27;,
451
+ &#x27;on-error&#x27;: &#x27;error100&#x27;,
452
+ &#x27;on-error-container&#x27;: &#x27;error10&#x27;,
453
+ &#x27;on-primary&#x27;: &#x27;primary100&#x27;,
454
+ &#x27;on-primary-container&#x27;: &#x27;primary10&#x27;,
455
+ &#x27;on-primary-fixed&#x27;: &#x27;primary10&#x27;,
456
+ &#x27;on-primary-fixed-variant&#x27;: &#x27;primary30&#x27;,
457
+ &#x27;on-secondary&#x27;: &#x27;secondary100&#x27;,
458
+ &#x27;on-secondary-container&#x27;: &#x27;secondary10&#x27;,
459
+ &#x27;on-secondary-fixed&#x27;: &#x27;secondary10&#x27;,
460
+ &#x27;on-secondary-fixed-variant&#x27;: &#x27;secondary30&#x27;,
461
+ &#x27;on-surface&#x27;: &#x27;neutral10&#x27;,
462
+ &#x27;on-surface-variant&#x27;: &#x27;neutral-variant30&#x27;,
463
+ &#x27;on-tertiary&#x27;: &#x27;tertiary100&#x27;,
464
+ &#x27;on-tertiary-container&#x27;: &#x27;tertiary10&#x27;,
465
+ &#x27;on-tertiary-fixed&#x27;: &#x27;tertiary10&#x27;,
466
+ &#x27;on-tertiary-fixed-variant&#x27;: &#x27;tertiary30&#x27;,
467
+ outline: &#x27;neutral-variant50&#x27;,
468
+ &#x27;outline-variant&#x27;: &#x27;neutral-variant80&#x27;,
469
+ primary: &#x27;primary40&#x27;,
470
+ &#x27;primary-container&#x27;: &#x27;primary90&#x27;,
471
+ &#x27;primary-fixed&#x27;: &#x27;primary90&#x27;,
472
+ &#x27;primary-fixed-dim&#x27;: &#x27;primary80&#x27;,
473
+ scrim: &#x27;neutral0&#x27;,
474
+ secondary: &#x27;secondary40&#x27;,
475
+ &#x27;secondary-container&#x27;: &#x27;secondary90&#x27;,
476
+ &#x27;secondary-fixed&#x27;: &#x27;secondary90&#x27;,
477
+ &#x27;secondary-fixed-dim&#x27;: &#x27;secondary80&#x27;,
478
+ shadow: &#x27;neutral0&#x27;,
479
+ surface: &#x27;neutral98&#x27;,
480
+ &#x27;surface-bright&#x27;: &#x27;neutral98&#x27;,
481
+ &#x27;surface-container&#x27;: &#x27;neutral94&#x27;,
482
+ &#x27;surface-container-high&#x27;: &#x27;neutral92&#x27;,
483
+ &#x27;surface-container-highest&#x27;: &#x27;neutral90&#x27;,
484
+ &#x27;surface-container-low&#x27;: &#x27;neutral96&#x27;,
485
+ &#x27;surface-container-lowest&#x27;: &#x27;neutral100&#x27;,
486
+ &#x27;surface-dim&#x27;: &#x27;neutral87&#x27;,
487
+ &#x27;surface-tint&#x27;: &#x27;primary40&#x27;,
488
+ &#x27;surface-variant&#x27;: &#x27;neutral-variant90&#x27;,
489
+ tertiary: &#x27;tertiary40&#x27;,
490
+ &#x27;tertiary-container&#x27;: &#x27;tertiary90&#x27;,
491
+ &#x27;tertiary-fixed&#x27;: &#x27;tertiary90&#x27;,
492
+ &#x27;tertiary-fixed-dim&#x27;: &#x27;tertiary80&#x27;,
493
+ };
494
+
495
+ const darkRoleToRefKeyMap: Record&lt;string, string&gt; &#x3D; {
496
+ background: &#x27;neutral6&#x27;,
497
+ error: &#x27;error80&#x27;,
498
+ &#x27;error-container&#x27;: &#x27;error30&#x27;,
499
+ &#x27;inverse-on-surface&#x27;: &#x27;neutral20&#x27;,
500
+ &#x27;inverse-primary&#x27;: &#x27;primary40&#x27;,
501
+ &#x27;inverse-surface&#x27;: &#x27;neutral90&#x27;,
502
+ &#x27;on-background&#x27;: &#x27;neutral90&#x27;,
503
+ &#x27;on-error&#x27;: &#x27;error20&#x27;,
504
+ &#x27;on-error-container&#x27;: &#x27;error90&#x27;,
505
+ &#x27;on-primary&#x27;: &#x27;primary20&#x27;,
506
+ &#x27;on-primary-container&#x27;: &#x27;primary90&#x27;,
507
+ &#x27;on-primary-fixed&#x27;: &#x27;primary10&#x27;,
508
+ &#x27;on-primary-fixed-variant&#x27;: &#x27;primary30&#x27;,
509
+ &#x27;on-secondary&#x27;: &#x27;secondary20&#x27;,
510
+ &#x27;on-secondary-container&#x27;: &#x27;secondary90&#x27;,
511
+ &#x27;on-secondary-fixed&#x27;: &#x27;secondary10&#x27;,
512
+ &#x27;on-secondary-fixed-variant&#x27;: &#x27;secondary30&#x27;,
513
+ &#x27;on-surface&#x27;: &#x27;neutral90&#x27;,
514
+ &#x27;on-surface-variant&#x27;: &#x27;neutral-variant90&#x27;,
515
+ &#x27;on-tertiary&#x27;: &#x27;tertiary20&#x27;,
516
+ &#x27;on-tertiary-container&#x27;: &#x27;tertiary90&#x27;,
517
+ &#x27;on-tertiary-fixed&#x27;: &#x27;tertiary10&#x27;,
518
+ &#x27;on-tertiary-fixed-variant&#x27;: &#x27;tertiary30&#x27;,
519
+ outline: &#x27;neutral-variant60&#x27;,
520
+ &#x27;outline-variant&#x27;: &#x27;neutral-variant30&#x27;,
521
+ primary: &#x27;primary80&#x27;,
522
+ &#x27;primary-container&#x27;: &#x27;primary30&#x27;,
523
+ &#x27;primary-fixed&#x27;: &#x27;primary90&#x27;,
524
+ &#x27;primary-fixed-dim&#x27;: &#x27;primary80&#x27;,
525
+ scrim: &#x27;neutral0&#x27;,
526
+ secondary: &#x27;secondary80&#x27;,
527
+ &#x27;secondary-container&#x27;: &#x27;secondary30&#x27;,
528
+ &#x27;secondary-fixed&#x27;: &#x27;secondary90&#x27;,
529
+ &#x27;secondary-fixed-dim&#x27;: &#x27;secondary80&#x27;,
530
+ shadow: &#x27;neutral0&#x27;,
531
+ surface: &#x27;neutral6&#x27;,
532
+ &#x27;surface-bright&#x27;: &#x27;neutral24&#x27;,
533
+ &#x27;surface-container&#x27;: &#x27;neutral12&#x27;,
534
+ &#x27;surface-container-high&#x27;: &#x27;neutral17&#x27;,
535
+ &#x27;surface-container-highest&#x27;: &#x27;neutral24&#x27;,
536
+ &#x27;surface-container-low&#x27;: &#x27;neutral10&#x27;,
537
+ &#x27;surface-container-lowest&#x27;: &#x27;neutral4&#x27;,
538
+ &#x27;surface-dim&#x27;: &#x27;neutral6&#x27;,
539
+ &#x27;surface-tint&#x27;: &#x27;primary80&#x27;,
540
+ &#x27;surface-variant&#x27;: &#x27;neutral-variant30&#x27;,
541
+ tertiary: &#x27;tertiary80&#x27;,
542
+ &#x27;tertiary-container&#x27;: &#x27;tertiary30&#x27;,
543
+ &#x27;tertiary-fixed&#x27;: &#x27;tertiary90&#x27;,
544
+ &#x27;tertiary-fixed-dim&#x27;: &#x27;tertiary80&#x27;,
545
+ };
546
+
547
+ export interface ThemeColors {
548
+ primary: string;
549
+ secondary?: string;
550
+ tertiary?: string;
551
+ neutral?: string;
552
+ neutralVariant?: string;
553
+ error?: string;
554
+ }
555
+
556
+ export class ThemeColor {
557
+ static apply(
558
+ document: Document,
559
+ {
560
+ primary,
561
+ secondary,
562
+ tertiary,
563
+ neutral,
564
+ neutralVariant,
565
+ error,
566
+ }: ThemeColors
567
+ ) {
568
+ const themeColor &#x3D; new ThemeColor();
569
+ themeColor.apply(
570
+ document,
571
+ primary,
572
+ secondary,
573
+ tertiary,
574
+ neutral,
575
+ neutralVariant,
576
+ error
577
+ );
578
+ }
579
+
580
+ private generateSystemLevelColors(
581
+ primaryPalette: BasePalette,
582
+ themeType: ThemeType,
583
+ tertiaryPalette?: BasePalette,
584
+ cssVarPrefix &#x3D; &#x27;--mat-sys-&#x27;
585
+ ): CssVariables {
586
+ const tertiary &#x3D; tertiaryPalette ?? primaryPalette; // Default tertiary to primary
587
+ const output: CssVariables &#x3D; {};
588
+
589
+ // 1. Create the flattened reference palette (md-ref-palette equivalent)
590
+ // We use kebab-case for keys like &#x27;neutral-variant&#x27; to match the role maps.
591
+ const refPalette: Record&lt;string, ColorValue&gt; &#x3D; {};
592
+
593
+ const palettesToFlatten: Record&lt;string, TonePalette&gt; &#x3D; {
594
+ primary: primaryPalette,
595
+ secondary: primaryPalette.secondary,
596
+ tertiary: tertiary, // Use the resolved tertiary palette (just tones)
597
+ neutral: primaryPalette.neutral,
598
+ &#x27;neutral-variant&#x27;: primaryPalette.neutralVariant,
599
+ error: primaryPalette.error,
600
+ };
601
+
602
+ for (const [name, palette] of Object.entries(palettesToFlatten)) {
603
+ if (!palette) {
604
+ console.warn(
605
+ &#x60;Warning: Palette source &#x27;${name}&#x27; is missing or undefined.&#x60;
606
+ );
607
+ continue;
608
+ }
609
+ for (const [tone, value] of Object.entries(palette)) {
610
+ // Check if the key is a valid tone number (string representation) and value is a string color
611
+ if (!isNaN(Number(tone)) &amp;&amp; typeof value &#x3D;&#x3D;&#x3D; &#x27;string&#x27;) {
612
+ const key &#x3D; &#x60;${name}${tone}&#x60;; // e.g., primary40, neutral98, neutral-variant30
613
+ refPalette[key] &#x3D; value;
614
+ }
615
+ }
616
+ }
617
+
618
+ // 2. Select the correct role mapping based on theme type
619
+ const roleToRefKeyMap &#x3D;
620
+ themeType &#x3D;&#x3D;&#x3D; &#x27;light&#x27; ? lightRoleToRefKeyMap : darkRoleToRefKeyMap;
621
+
622
+ // 3. Generate CSS variables from the mapping
623
+ for (const [role, refKey] of Object.entries(roleToRefKeyMap)) {
624
+ const colorValue &#x3D; refPalette[refKey];
625
+ if (colorValue &#x3D;&#x3D;&#x3D; undefined) {
626
+ // Log a warning if a required reference color is missing in the provided palettes
627
+ console.warn(
628
+ &#x60;Warning: Reference color key &#x27;${refKey}&#x27; not found in generated reference palette for CSS variable role &#x27;${role}&#x27;. Skipping variable &#x27;${cssVarPrefix}${role}&#x27;.&#x60;
629
+ );
630
+ continue; // Skip this variable if the color isn&#x27;t found
631
+ }
632
+ output[&#x60;${cssVarPrefix}${role}&#x60;] &#x3D; colorValue;
633
+ }
634
+
635
+ // 4. Add the extra manually inserted colors (as per _m3-system.scss logic)
636
+ // These seem to be directly used sometimes instead of going through roles.
637
+ const extraRefKeys: Record&lt;string, string&gt; &#x3D; {
638
+ &#x27;neutral-variant20&#x27;: &#x27;neutral-variant20&#x27;, // Role name maps directly to ref key
639
+ neutral10: &#x27;neutral10&#x27;,
640
+ };
641
+ for (const [role, refKey] of Object.entries(extraRefKeys)) {
642
+ const colorValue &#x3D; refPalette[refKey];
643
+ if (colorValue !&#x3D;&#x3D; undefined) {
644
+ // Check if it wasn&#x27;t already added via the main mapping (unlikely but safe)
645
+ if (!output[&#x60;${cssVarPrefix}${role}&#x60;]) {
646
+ output[&#x60;${cssVarPrefix}${role}&#x60;] &#x3D; colorValue;
647
+ }
648
+ } else {
649
+ console.warn(
650
+ &#x60;Warning: Extra color key &#x27;${refKey}&#x27; not found in generated reference palette for role &#x27;${role}&#x27;.&#x60;
651
+ );
652
+ }
653
+ }
654
+
655
+ return output;
656
+ }
657
+
658
+ /**
659
+ * Helper function to convert a TonalPalette to a TonePalette.
660
+ * @param tonalPalette TonalPalette instance
661
+ * @returns TonePalette object
662
+ */
663
+ private convertTonalPalette(tonalPalette: TonalPalette): TonePalette {
664
+ const tones: Tone[] &#x3D; [
665
+ 0, 4, 6, 10, 12, 17, 20, 22, 24, 25, 30, 35, 40, 50, 60, 70, 80, 87, 90,
666
+ 92, 94, 95, 96, 98, 99, 100,
667
+ ];
668
+ const result: TonePalette &#x3D; {};
669
+
670
+ for (const tone of tones) {
671
+ result[tone] &#x3D; tonalPalette.tone(tone).toString(16).replace(/^ff/i, &#x27;#&#x27;); // Convert ARGB to HEX
672
+ }
673
+
674
+ return result;
675
+ }
676
+
677
+ /**
678
+ * Converts a CorePalette into a BasePalette structure.
679
+ * @param corePalette CorePalette instance
680
+ * @returns BasePalette object
681
+ */
682
+ private convertCorePaletteToBasePalette(
683
+ corePalette: CorePalette
684
+ ): BasePalette {
685
+ return {
686
+ ...this.convertTonalPalette(corePalette.a1), // Primary tones
687
+ secondary: this.convertTonalPalette(corePalette.a2),
688
+ tertiary: this.convertTonalPalette(corePalette.a3),
689
+ neutral: this.convertTonalPalette(corePalette.n1),
690
+ neutralVariant: this.convertTonalPalette(corePalette.n2),
691
+ error: this.convertTonalPalette(corePalette.error),
692
+ };
693
+ }
694
+
695
+ private mergeLightAndDarkVars(
696
+ lightVars: CssVariables,
697
+ darkVars: CssVariables
698
+ ): CssVariables {
699
+ const output: CssVariables &#x3D; {};
700
+ for (const [key, value] of Object.entries(lightVars)) {
701
+ output[key] &#x3D; value;
702
+ }
703
+ for (const [key, value] of Object.entries(darkVars)) {
704
+ output[key] &#x3D; &#x60;light-dark(${output[key]}, ${value})&#x60;;
705
+ }
706
+ return output;
707
+ }
708
+
709
+ private convertBasePaletteToCss(lightDarkVars: CssVariables) {
710
+ return &#x60;:root {
711
+ ${Object.entries(lightDarkVars)
712
+ .map(([key, value]) &#x3D;&gt; &#x60;${key}: ${value};&#x60;)
713
+ .join(&#x27;\n &#x27;)}
714
+ }
715
+ &#x60;;
716
+ }
717
+
718
+ apply(
719
+ document: Document,
720
+ primary: string,
721
+ secondary?: string,
722
+ tertiary?: string,
723
+ neutral?: string,
724
+ neutralVariant?: string,
725
+ error?: string
726
+ ) {
727
+ const corePalette &#x3D; CorePalette.fromColors({
728
+ primary: parseInt(primary.replace(&#x27;#&#x27;, &#x27;FF&#x27;), 16),
729
+ secondary: secondary
730
+ ? parseInt(secondary.replace(&#x27;#&#x27;, &#x27;FF&#x27;), 16)
731
+ : undefined,
732
+ tertiary: tertiary
733
+ ? parseInt(tertiary.replace(&#x27;#&#x27;, &#x27;FF&#x27;), 16)
734
+ : undefined,
735
+ neutral: neutral ? parseInt(neutral.replace(&#x27;#&#x27;, &#x27;FF&#x27;), 16) : undefined,
736
+ neutralVariant: neutralVariant
737
+ ? parseInt(neutralVariant.replace(&#x27;#&#x27;, &#x27;FF&#x27;), 16)
738
+ : undefined,
739
+ error: error ? parseInt(error.replace(&#x27;#&#x27;, &#x27;FF&#x27;), 16) : undefined,
740
+ });
741
+
742
+ const basePalette &#x3D; this.convertCorePaletteToBasePalette(corePalette);
743
+
744
+ const lightVars &#x3D; this.generateSystemLevelColors(basePalette, &#x27;light&#x27;);
745
+ const darkVars &#x3D; this.generateSystemLevelColors(basePalette, &#x27;dark&#x27;);
746
+ const lightDarkVars &#x3D; this.mergeLightAndDarkVars(lightVars, darkVars);
747
+
748
+ for (const [key, value] of Object.entries(lightDarkVars)) {
749
+ document.documentElement.style.setProperty(key, value);
750
+ }
751
+ }
752
+ }
753
+
754
+ export function applyThemeColorBootstrapHook(defaultThemeControls?: ThemeColors) {
755
+ return (config: ConfigService) &#x3D;&gt; {
756
+ const themeColors &#x3D; config.get(&#x27;theme.colors&#x27;, defaultThemeControls);
757
+ if (themeColors) {
758
+ ThemeColor.apply(window.document, themeColors);
759
+ }
760
+ };
761
+ }
762
+ </code></pre>
763
+ </div>
764
+ </div>
765
+
766
+
767
+
768
+
769
+
770
+
771
+
772
+
773
+ </div><div class="search-results">
774
+ <div class="has-results">
775
+ <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
776
+ <ul class="search-results-list"></ul>
777
+ </div>
778
+ <div class="no-results">
779
+ <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
780
+ </div>
781
+ </div>
782
+ </div>
783
+ <!-- END CONTENT -->
784
+ </div>
785
+ </div>
786
+
787
+ <label class="dark-mode-switch">
788
+ <input type="checkbox">
789
+ <span class="slider">
790
+ <svg class="slider-icon" viewBox="0 0 24 24" fill="none" height="20" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" width="20" xmlns="http://www.w3.org/2000/svg">
791
+ <path d="M21 12.79A9 9 0 1111.21 3 7 7 0 0021 12.79z"></path>
792
+ </svg>
793
+ </span>
794
+ </label>
795
+
796
+ <script>
797
+ var COMPODOC_CURRENT_PAGE_DEPTH = 1;
798
+ var COMPODOC_CURRENT_PAGE_CONTEXT = 'interface';
799
+ var COMPODOC_CURRENT_PAGE_URL = 'BasePalette.html';
800
+ var MAX_SEARCH_RESULTS = 15;
801
+ </script>
802
+
803
+ <script>
804
+ $darkModeToggleSwitchers = document.querySelectorAll('.dark-mode-switch input');
805
+ checkToggle(darkModeState);
806
+ if ($darkModeToggleSwitchers.length > 0) {
807
+ for (var i = 0; i < $darkModeToggleSwitchers.length; i++) {
808
+ $darkModeToggleSwitchers[i].addEventListener('change', function (event) {
809
+ darkModeState = !darkModeState;
810
+ toggleDarkMode(darkModeState);
811
+ });
812
+ }
813
+ }
814
+ </script>
815
+
816
+ <script src="../js/libs/custom-elements.min.js"></script>
817
+ <script src="../js/libs/lit-html.js"></script>
818
+
819
+ <script src="../js/menu-wc.js" defer></script>
820
+ <script nomodule src="../js/menu-wc_es5.js" defer></script>
821
+
822
+ <script src="../js/libs/bootstrap-native.js"></script>
823
+
824
+ <script src="../js/libs/es6-shim.min.js"></script>
825
+ <script src="../js/libs/EventDispatcher.js"></script>
826
+ <script src="../js/libs/promise.min.js"></script>
827
+ <script src="../js/libs/zepto.min.js"></script>
828
+
829
+ <script src="../js/compodoc.js"></script>
830
+
831
+ <script src="../js/tabs.js"></script>
832
+ <script src="../js/menu.js"></script>
833
+ <script src="../js/libs/clipboard.min.js"></script>
834
+ <script src="../js/libs/prism.js"></script>
835
+ <script src="../js/sourceCode.js"></script>
836
+ <script src="../js/search/search.js"></script>
837
+ <script src="../js/search/lunr.min.js"></script>
838
+ <script src="../js/search/search-lunr.js"></script>
839
+ <script src="../js/search/search_index.js"></script>
840
+ <script src="../js/lazy-load-graphs.js"></script>
841
+
842
+
843
+ </body>
844
+ </html>