@rxap/ngx-theme 19.1.0-dev.0 → 19.1.0-dev.3

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