@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,898 @@
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
+ ThemeColors</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
+
130
+
131
+ <section data-compodoc="block-index">
132
+ <h3 id="index">Index</h3>
133
+ <table class="table table-sm table-bordered index-table">
134
+ <tbody>
135
+ <tr>
136
+ <td class="col-md-4">
137
+ <h6><b>Properties</b></h6>
138
+ </td>
139
+ </tr>
140
+ <tr>
141
+ <td class="col-md-4">
142
+ <ul class="index-list">
143
+ <li>
144
+ <span class="modifier">Optional</span>
145
+ <a href="#error"
146
+ >
147
+ error
148
+ </a>
149
+ </li>
150
+ <li>
151
+ <span class="modifier">Optional</span>
152
+ <a href="#neutral"
153
+ >
154
+ neutral
155
+ </a>
156
+ </li>
157
+ <li>
158
+ <span class="modifier">Optional</span>
159
+ <a href="#neutralVariant"
160
+ >
161
+ neutralVariant
162
+ </a>
163
+ </li>
164
+ <li>
165
+ <a href="#primary"
166
+ >
167
+ primary
168
+ </a>
169
+ </li>
170
+ <li>
171
+ <span class="modifier">Optional</span>
172
+ <a href="#secondary"
173
+ >
174
+ secondary
175
+ </a>
176
+ </li>
177
+ <li>
178
+ <span class="modifier">Optional</span>
179
+ <a href="#tertiary"
180
+ >
181
+ tertiary
182
+ </a>
183
+ </li>
184
+ </ul>
185
+ </td>
186
+ </tr>
187
+ </tbody>
188
+ </table>
189
+ </section>
190
+
191
+
192
+
193
+ <section data-compodoc="block-properties">
194
+ <h3 id="inputs">Properties</h3>
195
+ <table class="table table-sm table-bordered">
196
+ <tbody>
197
+ <tr>
198
+ <td class="col-md-4">
199
+ <a name="error"></a>
200
+ <span class="name "><b>error</b>
201
+ <a href="#error">
202
+ <span class="icon ion-ios-link"></span>
203
+ </a>
204
+ </span>
205
+ </td>
206
+ </tr>
207
+ <tr>
208
+ <td class="col-md-4">
209
+ <code>error: <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank" >string</a></code>
210
+ </code>
211
+ </td>
212
+ </tr>
213
+
214
+
215
+ <tr>
216
+ <td class="col-md-4">
217
+ <i>Type : </i> <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank" >string</a></code>
218
+
219
+ </td>
220
+ </tr>
221
+
222
+ <tr>
223
+ <td class="col-md-4">
224
+ <i>Optional</i>
225
+ </td>
226
+ </tr>
227
+
228
+
229
+
230
+
231
+ </tbody>
232
+ </table>
233
+ <table class="table table-sm table-bordered">
234
+ <tbody>
235
+ <tr>
236
+ <td class="col-md-4">
237
+ <a name="neutral"></a>
238
+ <span class="name "><b>neutral</b>
239
+ <a href="#neutral">
240
+ <span class="icon ion-ios-link"></span>
241
+ </a>
242
+ </span>
243
+ </td>
244
+ </tr>
245
+ <tr>
246
+ <td class="col-md-4">
247
+ <code>neutral: <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank" >string</a></code>
248
+ </code>
249
+ </td>
250
+ </tr>
251
+
252
+
253
+ <tr>
254
+ <td class="col-md-4">
255
+ <i>Type : </i> <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank" >string</a></code>
256
+
257
+ </td>
258
+ </tr>
259
+
260
+ <tr>
261
+ <td class="col-md-4">
262
+ <i>Optional</i>
263
+ </td>
264
+ </tr>
265
+
266
+
267
+
268
+
269
+ </tbody>
270
+ </table>
271
+ <table class="table table-sm table-bordered">
272
+ <tbody>
273
+ <tr>
274
+ <td class="col-md-4">
275
+ <a name="neutralVariant"></a>
276
+ <span class="name "><b>neutralVariant</b>
277
+ <a href="#neutralVariant">
278
+ <span class="icon ion-ios-link"></span>
279
+ </a>
280
+ </span>
281
+ </td>
282
+ </tr>
283
+ <tr>
284
+ <td class="col-md-4">
285
+ <code>neutralVariant: <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank" >string</a></code>
286
+ </code>
287
+ </td>
288
+ </tr>
289
+
290
+
291
+ <tr>
292
+ <td class="col-md-4">
293
+ <i>Type : </i> <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank" >string</a></code>
294
+
295
+ </td>
296
+ </tr>
297
+
298
+ <tr>
299
+ <td class="col-md-4">
300
+ <i>Optional</i>
301
+ </td>
302
+ </tr>
303
+
304
+
305
+
306
+
307
+ </tbody>
308
+ </table>
309
+ <table class="table table-sm table-bordered">
310
+ <tbody>
311
+ <tr>
312
+ <td class="col-md-4">
313
+ <a name="primary"></a>
314
+ <span class="name "><b>primary</b>
315
+ <a href="#primary">
316
+ <span class="icon ion-ios-link"></span>
317
+ </a>
318
+ </span>
319
+ </td>
320
+ </tr>
321
+ <tr>
322
+ <td class="col-md-4">
323
+ <code>primary: <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank" >string</a></code>
324
+ </code>
325
+ </td>
326
+ </tr>
327
+
328
+
329
+ <tr>
330
+ <td class="col-md-4">
331
+ <i>Type : </i> <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank" >string</a></code>
332
+
333
+ </td>
334
+ </tr>
335
+
336
+
337
+
338
+
339
+
340
+ </tbody>
341
+ </table>
342
+ <table class="table table-sm table-bordered">
343
+ <tbody>
344
+ <tr>
345
+ <td class="col-md-4">
346
+ <a name="secondary"></a>
347
+ <span class="name "><b>secondary</b>
348
+ <a href="#secondary">
349
+ <span class="icon ion-ios-link"></span>
350
+ </a>
351
+ </span>
352
+ </td>
353
+ </tr>
354
+ <tr>
355
+ <td class="col-md-4">
356
+ <code>secondary: <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank" >string</a></code>
357
+ </code>
358
+ </td>
359
+ </tr>
360
+
361
+
362
+ <tr>
363
+ <td class="col-md-4">
364
+ <i>Type : </i> <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank" >string</a></code>
365
+
366
+ </td>
367
+ </tr>
368
+
369
+ <tr>
370
+ <td class="col-md-4">
371
+ <i>Optional</i>
372
+ </td>
373
+ </tr>
374
+
375
+
376
+
377
+
378
+ </tbody>
379
+ </table>
380
+ <table class="table table-sm table-bordered">
381
+ <tbody>
382
+ <tr>
383
+ <td class="col-md-4">
384
+ <a name="tertiary"></a>
385
+ <span class="name "><b>tertiary</b>
386
+ <a href="#tertiary">
387
+ <span class="icon ion-ios-link"></span>
388
+ </a>
389
+ </span>
390
+ </td>
391
+ </tr>
392
+ <tr>
393
+ <td class="col-md-4">
394
+ <code>tertiary: <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank" >string</a></code>
395
+ </code>
396
+ </td>
397
+ </tr>
398
+
399
+
400
+ <tr>
401
+ <td class="col-md-4">
402
+ <i>Type : </i> <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank" >string</a></code>
403
+
404
+ </td>
405
+ </tr>
406
+
407
+ <tr>
408
+ <td class="col-md-4">
409
+ <i>Optional</i>
410
+ </td>
411
+ </tr>
412
+
413
+
414
+
415
+
416
+ </tbody>
417
+ </table>
418
+ </section>
419
+ </div>
420
+
421
+
422
+ <div class="tab-pane fade tab-source-code" id="source">
423
+ <pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">import {
424
+ CorePalette,
425
+ TonalPalette
426
+ } from &#x27;@material/material-color-utilities&#x27;;
427
+ import { ConfigService } from &#x27;@rxap/config&#x27;;
428
+
429
+ /**
430
+ * Represents the tone scale numbers used in Material Design palettes.
431
+ * Includes standard tones and specific neutral tones used for surfaces.
432
+ */
433
+ type Tone &#x3D;
434
+ | 0
435
+ | 4
436
+ | 6
437
+ | 10
438
+ | 12
439
+ | 17
440
+ | 20
441
+ | 22
442
+ | 24
443
+ | 25
444
+ | 30
445
+ | 35
446
+ | 40
447
+ | 50
448
+ | 60
449
+ | 70
450
+ | 80
451
+ | 87
452
+ | 90
453
+ | 92
454
+ | 94
455
+ | 95
456
+ | 96
457
+ | 98
458
+ | 99
459
+ | 100;
460
+
461
+ /**
462
+ * Represents a color value, typically a hex string.
463
+ */
464
+ type ColorValue &#x3D; string;
465
+
466
+ /**
467
+ * Represents a palette mapping tones to color values.
468
+ */
469
+ type TonePalette &#x3D; Partial&lt;Record&lt;Tone, ColorValue&gt;&gt;;
470
+
471
+ /**
472
+ * Represents the full structure of a Material Design base palette,
473
+ * including primary tones and nested palettes for secondary, neutral,
474
+ * neutral-variant, and error colors.
475
+ */
476
+ interface BasePalette extends TonePalette {
477
+ secondary: TonePalette;
478
+ tertiary: TonePalette;
479
+ neutral: TonePalette;
480
+ neutralVariant: TonePalette;
481
+ error: TonePalette;
482
+ }
483
+
484
+ /**
485
+ * Defines the possible theme types.
486
+ */
487
+ type ThemeType &#x3D; &#x27;light&#x27; | &#x27;dark&#x27;;
488
+
489
+ /**
490
+ * Represents the output map of CSS variable names to their color values.
491
+ * e.g., { &#x27;--mat-sys-primary&#x27;: &#x27;#6750A4&#x27;, ... }
492
+ */
493
+ type CssVariables &#x3D; Record&lt;string, ColorValue&gt;;
494
+
495
+ // --- Mappings from System Roles to Reference Palette Keys ---
496
+
497
+ const lightRoleToRefKeyMap: Record&lt;string, string&gt; &#x3D; {
498
+ background: &#x27;neutral98&#x27;,
499
+ error: &#x27;error40&#x27;,
500
+ &#x27;error-container&#x27;: &#x27;error90&#x27;,
501
+ &#x27;inverse-on-surface&#x27;: &#x27;neutral95&#x27;,
502
+ &#x27;inverse-primary&#x27;: &#x27;primary80&#x27;,
503
+ &#x27;inverse-surface&#x27;: &#x27;neutral20&#x27;,
504
+ &#x27;on-background&#x27;: &#x27;neutral10&#x27;,
505
+ &#x27;on-error&#x27;: &#x27;error100&#x27;,
506
+ &#x27;on-error-container&#x27;: &#x27;error10&#x27;,
507
+ &#x27;on-primary&#x27;: &#x27;primary100&#x27;,
508
+ &#x27;on-primary-container&#x27;: &#x27;primary10&#x27;,
509
+ &#x27;on-primary-fixed&#x27;: &#x27;primary10&#x27;,
510
+ &#x27;on-primary-fixed-variant&#x27;: &#x27;primary30&#x27;,
511
+ &#x27;on-secondary&#x27;: &#x27;secondary100&#x27;,
512
+ &#x27;on-secondary-container&#x27;: &#x27;secondary10&#x27;,
513
+ &#x27;on-secondary-fixed&#x27;: &#x27;secondary10&#x27;,
514
+ &#x27;on-secondary-fixed-variant&#x27;: &#x27;secondary30&#x27;,
515
+ &#x27;on-surface&#x27;: &#x27;neutral10&#x27;,
516
+ &#x27;on-surface-variant&#x27;: &#x27;neutral-variant30&#x27;,
517
+ &#x27;on-tertiary&#x27;: &#x27;tertiary100&#x27;,
518
+ &#x27;on-tertiary-container&#x27;: &#x27;tertiary10&#x27;,
519
+ &#x27;on-tertiary-fixed&#x27;: &#x27;tertiary10&#x27;,
520
+ &#x27;on-tertiary-fixed-variant&#x27;: &#x27;tertiary30&#x27;,
521
+ outline: &#x27;neutral-variant50&#x27;,
522
+ &#x27;outline-variant&#x27;: &#x27;neutral-variant80&#x27;,
523
+ primary: &#x27;primary40&#x27;,
524
+ &#x27;primary-container&#x27;: &#x27;primary90&#x27;,
525
+ &#x27;primary-fixed&#x27;: &#x27;primary90&#x27;,
526
+ &#x27;primary-fixed-dim&#x27;: &#x27;primary80&#x27;,
527
+ scrim: &#x27;neutral0&#x27;,
528
+ secondary: &#x27;secondary40&#x27;,
529
+ &#x27;secondary-container&#x27;: &#x27;secondary90&#x27;,
530
+ &#x27;secondary-fixed&#x27;: &#x27;secondary90&#x27;,
531
+ &#x27;secondary-fixed-dim&#x27;: &#x27;secondary80&#x27;,
532
+ shadow: &#x27;neutral0&#x27;,
533
+ surface: &#x27;neutral98&#x27;,
534
+ &#x27;surface-bright&#x27;: &#x27;neutral98&#x27;,
535
+ &#x27;surface-container&#x27;: &#x27;neutral94&#x27;,
536
+ &#x27;surface-container-high&#x27;: &#x27;neutral92&#x27;,
537
+ &#x27;surface-container-highest&#x27;: &#x27;neutral90&#x27;,
538
+ &#x27;surface-container-low&#x27;: &#x27;neutral96&#x27;,
539
+ &#x27;surface-container-lowest&#x27;: &#x27;neutral100&#x27;,
540
+ &#x27;surface-dim&#x27;: &#x27;neutral87&#x27;,
541
+ &#x27;surface-tint&#x27;: &#x27;primary40&#x27;,
542
+ &#x27;surface-variant&#x27;: &#x27;neutral-variant90&#x27;,
543
+ tertiary: &#x27;tertiary40&#x27;,
544
+ &#x27;tertiary-container&#x27;: &#x27;tertiary90&#x27;,
545
+ &#x27;tertiary-fixed&#x27;: &#x27;tertiary90&#x27;,
546
+ &#x27;tertiary-fixed-dim&#x27;: &#x27;tertiary80&#x27;,
547
+ };
548
+
549
+ const darkRoleToRefKeyMap: Record&lt;string, string&gt; &#x3D; {
550
+ background: &#x27;neutral6&#x27;,
551
+ error: &#x27;error80&#x27;,
552
+ &#x27;error-container&#x27;: &#x27;error30&#x27;,
553
+ &#x27;inverse-on-surface&#x27;: &#x27;neutral20&#x27;,
554
+ &#x27;inverse-primary&#x27;: &#x27;primary40&#x27;,
555
+ &#x27;inverse-surface&#x27;: &#x27;neutral90&#x27;,
556
+ &#x27;on-background&#x27;: &#x27;neutral90&#x27;,
557
+ &#x27;on-error&#x27;: &#x27;error20&#x27;,
558
+ &#x27;on-error-container&#x27;: &#x27;error90&#x27;,
559
+ &#x27;on-primary&#x27;: &#x27;primary20&#x27;,
560
+ &#x27;on-primary-container&#x27;: &#x27;primary90&#x27;,
561
+ &#x27;on-primary-fixed&#x27;: &#x27;primary10&#x27;,
562
+ &#x27;on-primary-fixed-variant&#x27;: &#x27;primary30&#x27;,
563
+ &#x27;on-secondary&#x27;: &#x27;secondary20&#x27;,
564
+ &#x27;on-secondary-container&#x27;: &#x27;secondary90&#x27;,
565
+ &#x27;on-secondary-fixed&#x27;: &#x27;secondary10&#x27;,
566
+ &#x27;on-secondary-fixed-variant&#x27;: &#x27;secondary30&#x27;,
567
+ &#x27;on-surface&#x27;: &#x27;neutral90&#x27;,
568
+ &#x27;on-surface-variant&#x27;: &#x27;neutral-variant90&#x27;,
569
+ &#x27;on-tertiary&#x27;: &#x27;tertiary20&#x27;,
570
+ &#x27;on-tertiary-container&#x27;: &#x27;tertiary90&#x27;,
571
+ &#x27;on-tertiary-fixed&#x27;: &#x27;tertiary10&#x27;,
572
+ &#x27;on-tertiary-fixed-variant&#x27;: &#x27;tertiary30&#x27;,
573
+ outline: &#x27;neutral-variant60&#x27;,
574
+ &#x27;outline-variant&#x27;: &#x27;neutral-variant30&#x27;,
575
+ primary: &#x27;primary80&#x27;,
576
+ &#x27;primary-container&#x27;: &#x27;primary30&#x27;,
577
+ &#x27;primary-fixed&#x27;: &#x27;primary90&#x27;,
578
+ &#x27;primary-fixed-dim&#x27;: &#x27;primary80&#x27;,
579
+ scrim: &#x27;neutral0&#x27;,
580
+ secondary: &#x27;secondary80&#x27;,
581
+ &#x27;secondary-container&#x27;: &#x27;secondary30&#x27;,
582
+ &#x27;secondary-fixed&#x27;: &#x27;secondary90&#x27;,
583
+ &#x27;secondary-fixed-dim&#x27;: &#x27;secondary80&#x27;,
584
+ shadow: &#x27;neutral0&#x27;,
585
+ surface: &#x27;neutral6&#x27;,
586
+ &#x27;surface-bright&#x27;: &#x27;neutral24&#x27;,
587
+ &#x27;surface-container&#x27;: &#x27;neutral12&#x27;,
588
+ &#x27;surface-container-high&#x27;: &#x27;neutral17&#x27;,
589
+ &#x27;surface-container-highest&#x27;: &#x27;neutral24&#x27;,
590
+ &#x27;surface-container-low&#x27;: &#x27;neutral10&#x27;,
591
+ &#x27;surface-container-lowest&#x27;: &#x27;neutral4&#x27;,
592
+ &#x27;surface-dim&#x27;: &#x27;neutral6&#x27;,
593
+ &#x27;surface-tint&#x27;: &#x27;primary80&#x27;,
594
+ &#x27;surface-variant&#x27;: &#x27;neutral-variant30&#x27;,
595
+ tertiary: &#x27;tertiary80&#x27;,
596
+ &#x27;tertiary-container&#x27;: &#x27;tertiary30&#x27;,
597
+ &#x27;tertiary-fixed&#x27;: &#x27;tertiary90&#x27;,
598
+ &#x27;tertiary-fixed-dim&#x27;: &#x27;tertiary80&#x27;,
599
+ };
600
+
601
+ export interface ThemeColors {
602
+ primary: string;
603
+ secondary?: string;
604
+ tertiary?: string;
605
+ neutral?: string;
606
+ neutralVariant?: string;
607
+ error?: string;
608
+ }
609
+
610
+ export class ThemeColor {
611
+ static apply(
612
+ document: Document,
613
+ {
614
+ primary,
615
+ secondary,
616
+ tertiary,
617
+ neutral,
618
+ neutralVariant,
619
+ error,
620
+ }: ThemeColors
621
+ ) {
622
+ const themeColor &#x3D; new ThemeColor();
623
+ themeColor.apply(
624
+ document,
625
+ primary,
626
+ secondary,
627
+ tertiary,
628
+ neutral,
629
+ neutralVariant,
630
+ error
631
+ );
632
+ }
633
+
634
+ private generateSystemLevelColors(
635
+ primaryPalette: BasePalette,
636
+ themeType: ThemeType,
637
+ tertiaryPalette?: BasePalette,
638
+ cssVarPrefix &#x3D; &#x27;--mat-sys-&#x27;
639
+ ): CssVariables {
640
+ const tertiary &#x3D; tertiaryPalette ?? primaryPalette; // Default tertiary to primary
641
+ const output: CssVariables &#x3D; {};
642
+
643
+ // 1. Create the flattened reference palette (md-ref-palette equivalent)
644
+ // We use kebab-case for keys like &#x27;neutral-variant&#x27; to match the role maps.
645
+ const refPalette: Record&lt;string, ColorValue&gt; &#x3D; {};
646
+
647
+ const palettesToFlatten: Record&lt;string, TonePalette&gt; &#x3D; {
648
+ primary: primaryPalette,
649
+ secondary: primaryPalette.secondary,
650
+ tertiary: tertiary, // Use the resolved tertiary palette (just tones)
651
+ neutral: primaryPalette.neutral,
652
+ &#x27;neutral-variant&#x27;: primaryPalette.neutralVariant,
653
+ error: primaryPalette.error,
654
+ };
655
+
656
+ for (const [name, palette] of Object.entries(palettesToFlatten)) {
657
+ if (!palette) {
658
+ console.warn(
659
+ &#x60;Warning: Palette source &#x27;${name}&#x27; is missing or undefined.&#x60;
660
+ );
661
+ continue;
662
+ }
663
+ for (const [tone, value] of Object.entries(palette)) {
664
+ // Check if the key is a valid tone number (string representation) and value is a string color
665
+ if (!isNaN(Number(tone)) &amp;&amp; typeof value &#x3D;&#x3D;&#x3D; &#x27;string&#x27;) {
666
+ const key &#x3D; &#x60;${name}${tone}&#x60;; // e.g., primary40, neutral98, neutral-variant30
667
+ refPalette[key] &#x3D; value;
668
+ }
669
+ }
670
+ }
671
+
672
+ // 2. Select the correct role mapping based on theme type
673
+ const roleToRefKeyMap &#x3D;
674
+ themeType &#x3D;&#x3D;&#x3D; &#x27;light&#x27; ? lightRoleToRefKeyMap : darkRoleToRefKeyMap;
675
+
676
+ // 3. Generate CSS variables from the mapping
677
+ for (const [role, refKey] of Object.entries(roleToRefKeyMap)) {
678
+ const colorValue &#x3D; refPalette[refKey];
679
+ if (colorValue &#x3D;&#x3D;&#x3D; undefined) {
680
+ // Log a warning if a required reference color is missing in the provided palettes
681
+ console.warn(
682
+ &#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;
683
+ );
684
+ continue; // Skip this variable if the color isn&#x27;t found
685
+ }
686
+ output[&#x60;${cssVarPrefix}${role}&#x60;] &#x3D; colorValue;
687
+ }
688
+
689
+ // 4. Add the extra manually inserted colors (as per _m3-system.scss logic)
690
+ // These seem to be directly used sometimes instead of going through roles.
691
+ const extraRefKeys: Record&lt;string, string&gt; &#x3D; {
692
+ &#x27;neutral-variant20&#x27;: &#x27;neutral-variant20&#x27;, // Role name maps directly to ref key
693
+ neutral10: &#x27;neutral10&#x27;,
694
+ };
695
+ for (const [role, refKey] of Object.entries(extraRefKeys)) {
696
+ const colorValue &#x3D; refPalette[refKey];
697
+ if (colorValue !&#x3D;&#x3D; undefined) {
698
+ // Check if it wasn&#x27;t already added via the main mapping (unlikely but safe)
699
+ if (!output[&#x60;${cssVarPrefix}${role}&#x60;]) {
700
+ output[&#x60;${cssVarPrefix}${role}&#x60;] &#x3D; colorValue;
701
+ }
702
+ } else {
703
+ console.warn(
704
+ &#x60;Warning: Extra color key &#x27;${refKey}&#x27; not found in generated reference palette for role &#x27;${role}&#x27;.&#x60;
705
+ );
706
+ }
707
+ }
708
+
709
+ return output;
710
+ }
711
+
712
+ /**
713
+ * Helper function to convert a TonalPalette to a TonePalette.
714
+ * @param tonalPalette TonalPalette instance
715
+ * @returns TonePalette object
716
+ */
717
+ private convertTonalPalette(tonalPalette: TonalPalette): TonePalette {
718
+ const tones: Tone[] &#x3D; [
719
+ 0, 4, 6, 10, 12, 17, 20, 22, 24, 25, 30, 35, 40, 50, 60, 70, 80, 87, 90,
720
+ 92, 94, 95, 96, 98, 99, 100,
721
+ ];
722
+ const result: TonePalette &#x3D; {};
723
+
724
+ for (const tone of tones) {
725
+ result[tone] &#x3D; tonalPalette.tone(tone).toString(16).replace(/^ff/i, &#x27;#&#x27;); // Convert ARGB to HEX
726
+ }
727
+
728
+ return result;
729
+ }
730
+
731
+ /**
732
+ * Converts a CorePalette into a BasePalette structure.
733
+ * @param corePalette CorePalette instance
734
+ * @returns BasePalette object
735
+ */
736
+ private convertCorePaletteToBasePalette(
737
+ corePalette: CorePalette
738
+ ): BasePalette {
739
+ return {
740
+ ...this.convertTonalPalette(corePalette.a1), // Primary tones
741
+ secondary: this.convertTonalPalette(corePalette.a2),
742
+ tertiary: this.convertTonalPalette(corePalette.a3),
743
+ neutral: this.convertTonalPalette(corePalette.n1),
744
+ neutralVariant: this.convertTonalPalette(corePalette.n2),
745
+ error: this.convertTonalPalette(corePalette.error),
746
+ };
747
+ }
748
+
749
+ private mergeLightAndDarkVars(
750
+ lightVars: CssVariables,
751
+ darkVars: CssVariables
752
+ ): CssVariables {
753
+ const output: CssVariables &#x3D; {};
754
+ for (const [key, value] of Object.entries(lightVars)) {
755
+ output[key] &#x3D; value;
756
+ }
757
+ for (const [key, value] of Object.entries(darkVars)) {
758
+ output[key] &#x3D; &#x60;light-dark(${output[key]}, ${value})&#x60;;
759
+ }
760
+ return output;
761
+ }
762
+
763
+ private convertBasePaletteToCss(lightDarkVars: CssVariables) {
764
+ return &#x60;:root {
765
+ ${Object.entries(lightDarkVars)
766
+ .map(([key, value]) &#x3D;&gt; &#x60;${key}: ${value};&#x60;)
767
+ .join(&#x27;\n &#x27;)}
768
+ }
769
+ &#x60;;
770
+ }
771
+
772
+ apply(
773
+ document: Document,
774
+ primary: string,
775
+ secondary?: string,
776
+ tertiary?: string,
777
+ neutral?: string,
778
+ neutralVariant?: string,
779
+ error?: string
780
+ ) {
781
+ const corePalette &#x3D; CorePalette.fromColors({
782
+ primary: parseInt(primary.replace(&#x27;#&#x27;, &#x27;FF&#x27;), 16),
783
+ secondary: secondary
784
+ ? parseInt(secondary.replace(&#x27;#&#x27;, &#x27;FF&#x27;), 16)
785
+ : undefined,
786
+ tertiary: tertiary
787
+ ? parseInt(tertiary.replace(&#x27;#&#x27;, &#x27;FF&#x27;), 16)
788
+ : undefined,
789
+ neutral: neutral ? parseInt(neutral.replace(&#x27;#&#x27;, &#x27;FF&#x27;), 16) : undefined,
790
+ neutralVariant: neutralVariant
791
+ ? parseInt(neutralVariant.replace(&#x27;#&#x27;, &#x27;FF&#x27;), 16)
792
+ : undefined,
793
+ error: error ? parseInt(error.replace(&#x27;#&#x27;, &#x27;FF&#x27;), 16) : undefined,
794
+ });
795
+
796
+ const basePalette &#x3D; this.convertCorePaletteToBasePalette(corePalette);
797
+
798
+ const lightVars &#x3D; this.generateSystemLevelColors(basePalette, &#x27;light&#x27;);
799
+ const darkVars &#x3D; this.generateSystemLevelColors(basePalette, &#x27;dark&#x27;);
800
+ const lightDarkVars &#x3D; this.mergeLightAndDarkVars(lightVars, darkVars);
801
+
802
+ for (const [key, value] of Object.entries(lightDarkVars)) {
803
+ document.documentElement.style.setProperty(key, value);
804
+ }
805
+ }
806
+ }
807
+
808
+ export function applyThemeColorBootstrapHook(defaultThemeControls?: ThemeColors) {
809
+ return (config: ConfigService) &#x3D;&gt; {
810
+ const themeColors &#x3D; config.get(&#x27;theme.colors&#x27;, defaultThemeControls);
811
+ if (themeColors) {
812
+ ThemeColor.apply(window.document, themeColors);
813
+ }
814
+ };
815
+ }
816
+ </code></pre>
817
+ </div>
818
+ </div>
819
+
820
+
821
+
822
+
823
+
824
+
825
+
826
+
827
+ </div><div class="search-results">
828
+ <div class="has-results">
829
+ <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
830
+ <ul class="search-results-list"></ul>
831
+ </div>
832
+ <div class="no-results">
833
+ <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
834
+ </div>
835
+ </div>
836
+ </div>
837
+ <!-- END CONTENT -->
838
+ </div>
839
+ </div>
840
+
841
+ <label class="dark-mode-switch">
842
+ <input type="checkbox">
843
+ <span class="slider">
844
+ <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">
845
+ <path d="M21 12.79A9 9 0 1111.21 3 7 7 0 0021 12.79z"></path>
846
+ </svg>
847
+ </span>
848
+ </label>
849
+
850
+ <script>
851
+ var COMPODOC_CURRENT_PAGE_DEPTH = 1;
852
+ var COMPODOC_CURRENT_PAGE_CONTEXT = 'interface';
853
+ var COMPODOC_CURRENT_PAGE_URL = 'ThemeColors.html';
854
+ var MAX_SEARCH_RESULTS = 15;
855
+ </script>
856
+
857
+ <script>
858
+ $darkModeToggleSwitchers = document.querySelectorAll('.dark-mode-switch input');
859
+ checkToggle(darkModeState);
860
+ if ($darkModeToggleSwitchers.length > 0) {
861
+ for (var i = 0; i < $darkModeToggleSwitchers.length; i++) {
862
+ $darkModeToggleSwitchers[i].addEventListener('change', function (event) {
863
+ darkModeState = !darkModeState;
864
+ toggleDarkMode(darkModeState);
865
+ });
866
+ }
867
+ }
868
+ </script>
869
+
870
+ <script src="../js/libs/custom-elements.min.js"></script>
871
+ <script src="../js/libs/lit-html.js"></script>
872
+
873
+ <script src="../js/menu-wc.js" defer></script>
874
+ <script nomodule src="../js/menu-wc_es5.js" defer></script>
875
+
876
+ <script src="../js/libs/bootstrap-native.js"></script>
877
+
878
+ <script src="../js/libs/es6-shim.min.js"></script>
879
+ <script src="../js/libs/EventDispatcher.js"></script>
880
+ <script src="../js/libs/promise.min.js"></script>
881
+ <script src="../js/libs/zepto.min.js"></script>
882
+
883
+ <script src="../js/compodoc.js"></script>
884
+
885
+ <script src="../js/tabs.js"></script>
886
+ <script src="../js/menu.js"></script>
887
+ <script src="../js/libs/clipboard.min.js"></script>
888
+ <script src="../js/libs/prism.js"></script>
889
+ <script src="../js/sourceCode.js"></script>
890
+ <script src="../js/search/search.js"></script>
891
+ <script src="../js/search/lunr.min.js"></script>
892
+ <script src="../js/search/search-lunr.js"></script>
893
+ <script src="../js/search/search_index.js"></script>
894
+ <script src="../js/lazy-load-graphs.js"></script>
895
+
896
+
897
+ </body>
898
+ </html>