@nanahoshi/mona-ui 0.27.2 → 0.29.0

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 (213) hide show
  1. package/docs/api/chart.md +2 -2
  2. package/docs/api/locales.md +8 -0
  3. package/docs/api/popup.md +1 -1
  4. package/docs/api/theme.md +2 -2
  5. package/docs/chart.md +14 -0
  6. package/docs/editor.md +2 -0
  7. package/docs/installation.md +147 -15
  8. package/docs/introduction.md +37 -15
  9. package/docs/theming-built-in-themes.md +67 -0
  10. package/docs/theming-custom-colors.md +274 -0
  11. package/docs/theming-custom-themes.md +168 -0
  12. package/docs/theming.md +164 -248
  13. package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +1089 -603
  14. package/fesm2022/nanahoshi-mona-ui-avatar.mjs +369 -184
  15. package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +658 -371
  16. package/fesm2022/nanahoshi-mona-ui-button-group.mjs +513 -359
  17. package/fesm2022/nanahoshi-mona-ui-button.mjs +622 -517
  18. package/fesm2022/nanahoshi-mona-ui-calendar.mjs +2071 -1573
  19. package/fesm2022/nanahoshi-mona-ui-card.mjs +620 -316
  20. package/fesm2022/nanahoshi-mona-ui-chart.mjs +61151 -64921
  21. package/fesm2022/nanahoshi-mona-ui-check-box.mjs +646 -317
  22. package/fesm2022/nanahoshi-mona-ui-chip.mjs +737 -516
  23. package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +441 -242
  24. package/fesm2022/nanahoshi-mona-ui-collapsible.mjs +443 -390
  25. package/fesm2022/nanahoshi-mona-ui-color-gradient.mjs +1138 -814
  26. package/fesm2022/nanahoshi-mona-ui-color-palette.mjs +1114 -959
  27. package/fesm2022/nanahoshi-mona-ui-color-picker.mjs +858 -504
  28. package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +1181 -742
  29. package/fesm2022/nanahoshi-mona-ui-command.mjs +1454 -853
  30. package/fesm2022/nanahoshi-mona-ui-common.mjs +569 -743
  31. package/fesm2022/nanahoshi-mona-ui-contextmenu.mjs +978 -532
  32. package/fesm2022/nanahoshi-mona-ui-date-input.mjs +283 -266
  33. package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +973 -451
  34. package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +1203 -658
  35. package/fesm2022/nanahoshi-mona-ui-dialog.mjs +1415 -936
  36. package/fesm2022/nanahoshi-mona-ui-dropdown-button.mjs +1165 -568
  37. package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +1142 -677
  38. package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +1018 -734
  39. package/fesm2022/nanahoshi-mona-ui-editor.mjs +3589 -2122
  40. package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +577 -359
  41. package/fesm2022/nanahoshi-mona-ui-fieldset.mjs +311 -151
  42. package/fesm2022/nanahoshi-mona-ui-filter.mjs +1086 -718
  43. package/fesm2022/nanahoshi-mona-ui-grid-grid-colgroup.component-NhONCVIX.mjs +77 -0
  44. package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-row.component-Djv8ZnT5.mjs +480 -0
  45. package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-WbXAzGCa.mjs +470 -0
  46. package/fesm2022/nanahoshi-mona-ui-grid-grid-row.component-DkWTD3pN.mjs +2115 -0
  47. package/fesm2022/nanahoshi-mona-ui-grid-grid-virtual-list.component-DAHqTwBJ.mjs +330 -0
  48. package/fesm2022/nanahoshi-mona-ui-grid-grid.styles-BmLU-3zP.mjs +3766 -0
  49. package/fesm2022/nanahoshi-mona-ui-grid.mjs +5418 -2
  50. package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +1379 -1079
  51. package/fesm2022/nanahoshi-mona-ui-i18n.mjs +4451 -5077
  52. package/fesm2022/nanahoshi-mona-ui-internal-filter-input.mjs +344 -143
  53. package/fesm2022/nanahoshi-mona-ui-internal-indicator-icon.mjs +257 -127
  54. package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +2080 -1829
  55. package/fesm2022/nanahoshi-mona-ui-internal-popup-menu.mjs +103 -141
  56. package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +2498 -2706
  57. package/fesm2022/nanahoshi-mona-ui-internal.mjs +722 -1007
  58. package/fesm2022/nanahoshi-mona-ui-label.mjs +313 -202
  59. package/fesm2022/nanahoshi-mona-ui-list-box.mjs +1308 -1009
  60. package/fesm2022/nanahoshi-mona-ui-list-view.mjs +1411 -677
  61. package/fesm2022/nanahoshi-mona-ui-list.mjs +1 -6
  62. package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +556 -577
  63. package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +530 -573
  64. package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +530 -573
  65. package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +533 -576
  66. package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +520 -555
  67. package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +530 -571
  68. package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +520 -555
  69. package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +520 -555
  70. package/fesm2022/nanahoshi-mona-ui-locales-pl-pl.mjs +599 -0
  71. package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +530 -571
  72. package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +576 -591
  73. package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +530 -565
  74. package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +520 -555
  75. package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +520 -555
  76. package/fesm2022/nanahoshi-mona-ui-locales.mjs +61 -77
  77. package/fesm2022/nanahoshi-mona-ui-menubar.mjs +1411 -829
  78. package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +1326 -702
  79. package/fesm2022/nanahoshi-mona-ui-notification.mjs +763 -675
  80. package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +1306 -826
  81. package/fesm2022/nanahoshi-mona-ui-otp-input.mjs +1122 -897
  82. package/fesm2022/nanahoshi-mona-ui-pager.mjs +1110 -651
  83. package/fesm2022/nanahoshi-mona-ui-placeholder.mjs +95 -53
  84. package/fesm2022/nanahoshi-mona-ui-popover.mjs +559 -397
  85. package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +2323 -1694
  86. package/fesm2022/nanahoshi-mona-ui-popup.mjs +1657 -1455
  87. package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +441 -267
  88. package/fesm2022/nanahoshi-mona-ui-query.mjs +211 -340
  89. package/fesm2022/nanahoshi-mona-ui-radio-button.mjs +1017 -548
  90. package/fesm2022/nanahoshi-mona-ui-rating.mjs +874 -624
  91. package/fesm2022/nanahoshi-mona-ui-scroll-view.mjs +1130 -917
  92. package/fesm2022/nanahoshi-mona-ui-segmented.mjs +705 -455
  93. package/fesm2022/nanahoshi-mona-ui-sheet.mjs +461 -283
  94. package/fesm2022/nanahoshi-mona-ui-sidebar.mjs +2791 -2449
  95. package/fesm2022/nanahoshi-mona-ui-skeleton.mjs +145 -90
  96. package/fesm2022/nanahoshi-mona-ui-slider.mjs +1563 -1103
  97. package/fesm2022/nanahoshi-mona-ui-spinner.mjs +738 -673
  98. package/fesm2022/nanahoshi-mona-ui-split-button.mjs +1287 -647
  99. package/fesm2022/nanahoshi-mona-ui-splitter.mjs +1313 -909
  100. package/fesm2022/nanahoshi-mona-ui-stepper.mjs +761 -540
  101. package/fesm2022/nanahoshi-mona-ui-switch.mjs +611 -280
  102. package/fesm2022/nanahoshi-mona-ui-tabs.mjs +1393 -841
  103. package/fesm2022/nanahoshi-mona-ui-text-area.mjs +142 -73
  104. package/fesm2022/nanahoshi-mona-ui-text-box.mjs +876 -374
  105. package/fesm2022/nanahoshi-mona-ui-theme.mjs +1465 -1449
  106. package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +897 -443
  107. package/fesm2022/nanahoshi-mona-ui-time-selector.mjs +1100 -703
  108. package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +789 -538
  109. package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +1361 -805
  110. package/fesm2022/nanahoshi-mona-ui-window.mjs +2145 -1531
  111. package/fesm2022/nanahoshi-mona-ui.mjs +1 -8
  112. package/llms.txt +7 -3
  113. package/locales/pl-pl/package.json +4 -0
  114. package/locales/pl-pl/pl-pl.messages.json +536 -0
  115. package/package.json +66 -23
  116. package/types/nanahoshi-mona-ui-auto-complete.d.ts +367 -233
  117. package/types/nanahoshi-mona-ui-avatar.d.ts +722 -649
  118. package/types/nanahoshi-mona-ui-breadcrumb.d.ts +134 -103
  119. package/types/nanahoshi-mona-ui-button-group.d.ts +213 -152
  120. package/types/nanahoshi-mona-ui-button.d.ts +227 -166
  121. package/types/nanahoshi-mona-ui-calendar.d.ts +324 -259
  122. package/types/nanahoshi-mona-ui-card.d.ts +125 -111
  123. package/types/nanahoshi-mona-ui-chart.d.ts +10483 -7326
  124. package/types/nanahoshi-mona-ui-check-box.d.ts +293 -180
  125. package/types/nanahoshi-mona-ui-chip.d.ts +208 -141
  126. package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +194 -133
  127. package/types/nanahoshi-mona-ui-collapsible.d.ts +103 -87
  128. package/types/nanahoshi-mona-ui-color-gradient.d.ts +281 -213
  129. package/types/nanahoshi-mona-ui-color-palette.d.ts +201 -138
  130. package/types/nanahoshi-mona-ui-color-picker.d.ts +283 -194
  131. package/types/nanahoshi-mona-ui-combo-box.d.ts +401 -262
  132. package/types/nanahoshi-mona-ui-command.d.ts +279 -191
  133. package/types/nanahoshi-mona-ui-common.d.ts +354 -385
  134. package/types/nanahoshi-mona-ui-contextmenu.d.ts +142 -117
  135. package/types/nanahoshi-mona-ui-date-input.d.ts +79 -96
  136. package/types/nanahoshi-mona-ui-date-picker.d.ts +338 -208
  137. package/types/nanahoshi-mona-ui-datetime-picker.d.ts +413 -259
  138. package/types/nanahoshi-mona-ui-dialog.d.ts +470 -381
  139. package/types/nanahoshi-mona-ui-dropdown-button.d.ts +216 -168
  140. package/types/nanahoshi-mona-ui-dropdown-list.d.ts +369 -243
  141. package/types/nanahoshi-mona-ui-dropdowns.d.ts +231 -217
  142. package/types/nanahoshi-mona-ui-editor.d.ts +302 -235
  143. package/types/nanahoshi-mona-ui-expansion-panel.d.ts +140 -109
  144. package/types/nanahoshi-mona-ui-fieldset.d.ts +98 -68
  145. package/types/nanahoshi-mona-ui-filter.d.ts +150 -124
  146. package/types/nanahoshi-mona-ui-grid.d.ts +1956 -1678
  147. package/types/nanahoshi-mona-ui-i18n-icu.d.ts +25 -34
  148. package/types/nanahoshi-mona-ui-i18n.d.ts +987 -1052
  149. package/types/nanahoshi-mona-ui-internal-filter-input.d.ts +118 -71
  150. package/types/nanahoshi-mona-ui-internal-indicator-icon.d.ts +56 -27
  151. package/types/nanahoshi-mona-ui-internal-list.d.ts +474 -408
  152. package/types/nanahoshi-mona-ui-internal-popup-menu.d.ts +143 -150
  153. package/types/nanahoshi-mona-ui-internal-tree.d.ts +493 -506
  154. package/types/nanahoshi-mona-ui-internal.d.ts +195 -213
  155. package/types/nanahoshi-mona-ui-label.d.ts +108 -78
  156. package/types/nanahoshi-mona-ui-list-box.d.ts +392 -322
  157. package/types/nanahoshi-mona-ui-list-view.d.ts +423 -282
  158. package/types/nanahoshi-mona-ui-list.d.ts +2 -1
  159. package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +540 -542
  160. package/types/nanahoshi-mona-ui-locales-de-de.d.ts +540 -542
  161. package/types/nanahoshi-mona-ui-locales-es-es.d.ts +540 -542
  162. package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +540 -542
  163. package/types/nanahoshi-mona-ui-locales-id-id.d.ts +540 -542
  164. package/types/nanahoshi-mona-ui-locales-it-it.d.ts +540 -542
  165. package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +540 -542
  166. package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +540 -542
  167. package/types/nanahoshi-mona-ui-locales-pl-pl.d.ts +540 -0
  168. package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +540 -542
  169. package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +540 -542
  170. package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +540 -542
  171. package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +540 -542
  172. package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +540 -542
  173. package/types/nanahoshi-mona-ui-locales.d.ts +18 -19
  174. package/types/nanahoshi-mona-ui-menubar.d.ts +210 -181
  175. package/types/nanahoshi-mona-ui-multi-select.d.ts +416 -276
  176. package/types/nanahoshi-mona-ui-notification.d.ts +140 -151
  177. package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +407 -270
  178. package/types/nanahoshi-mona-ui-otp-input.d.ts +364 -241
  179. package/types/nanahoshi-mona-ui-pager.d.ts +379 -301
  180. package/types/nanahoshi-mona-ui-placeholder.d.ts +35 -28
  181. package/types/nanahoshi-mona-ui-popover.d.ts +176 -134
  182. package/types/nanahoshi-mona-ui-popup-menu.d.ts +488 -344
  183. package/types/nanahoshi-mona-ui-popup.d.ts +698 -560
  184. package/types/nanahoshi-mona-ui-progress-bar.d.ts +197 -137
  185. package/types/nanahoshi-mona-ui-query.d.ts +82 -88
  186. package/types/nanahoshi-mona-ui-radio-button.d.ts +434 -269
  187. package/types/nanahoshi-mona-ui-rating.d.ts +348 -254
  188. package/types/nanahoshi-mona-ui-scroll-view.d.ts +244 -172
  189. package/types/nanahoshi-mona-ui-segmented.d.ts +250 -175
  190. package/types/nanahoshi-mona-ui-sheet.d.ts +115 -63
  191. package/types/nanahoshi-mona-ui-sidebar.d.ts +653 -493
  192. package/types/nanahoshi-mona-ui-skeleton.d.ts +55 -39
  193. package/types/nanahoshi-mona-ui-slider.d.ts +503 -354
  194. package/types/nanahoshi-mona-ui-spinner.d.ts +125 -112
  195. package/types/nanahoshi-mona-ui-split-button.d.ts +241 -196
  196. package/types/nanahoshi-mona-ui-splitter.d.ts +124 -78
  197. package/types/nanahoshi-mona-ui-stepper.d.ts +206 -181
  198. package/types/nanahoshi-mona-ui-switch.d.ts +197 -131
  199. package/types/nanahoshi-mona-ui-tabs.d.ts +349 -248
  200. package/types/nanahoshi-mona-ui-text-area.d.ts +52 -36
  201. package/types/nanahoshi-mona-ui-text-box.d.ts +349 -218
  202. package/types/nanahoshi-mona-ui-theme.d.ts +415 -408
  203. package/types/nanahoshi-mona-ui-time-picker.d.ts +357 -217
  204. package/types/nanahoshi-mona-ui-time-selector.d.ts +255 -170
  205. package/types/nanahoshi-mona-ui-tooltip.d.ts +222 -144
  206. package/types/nanahoshi-mona-ui-tree-view.d.ts +466 -308
  207. package/types/nanahoshi-mona-ui-window.d.ts +494 -399
  208. package/types/nanahoshi-mona-ui.d.ts +1 -2
  209. package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-row.component-DjNnVxHE.mjs +0 -181
  210. package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-ihQIKeP-.mjs +0 -208
  211. package/fesm2022/nanahoshi-mona-ui-grid-grid-row.component-BpnybNcs.mjs +0 -1082
  212. package/fesm2022/nanahoshi-mona-ui-grid-grid-virtual-list.component-CYlgfc7c.mjs +0 -186
  213. package/fesm2022/nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-LCzfCYd3.mjs +0 -7568
package/docs/theming.md CHANGED
@@ -1,86 +1,148 @@
1
1
  # Theming
2
2
 
3
- > Customize colors, density and shape through design tokens.
3
+ > Choose and switch themes, follow the system's dark mode, and use theme tokens in your own styles.
4
4
 
5
5
  Entry point: `@nanahoshi/mona-ui/theme`
6
6
 
7
- `@nanahoshi/mona-ui/theme` writes a theme's colors, shadows, motion and materials to `<html>` as CSS variables. Components read those variables through Tailwind classes, so a theme can change while the application runs, without a stylesheet of its own.
7
+ Every color, shadow, corner radius and animation speed in Mona UI comes from a theme. You can pick one of the built-in themes, let users switch between light and dark, generate colors from your brand, or register a theme of your own. This page explains how themes work and covers the everyday tasks. The pages under it go into detail.
8
8
 
9
- There are three built-in themes: `mona` (light and dark), `luna` (light and dark) and `anna` (dark only).
9
+ ## How Theming Works
10
10
 
11
- ---
11
+ A theme is a set of design tokens: named values such as `--color-primary` or `--radius-md`. Mona UI's `ThemeService` writes the active theme's tokens to the `<html>` element as CSS variables, and the components read them through Tailwind classes such as `bg-primary`. When the theme changes, the whole application follows at once, without a reload.
12
12
 
13
- ## 1. Setup
13
+ A theme defines these kinds of tokens:
14
14
 
15
- Add the package's stylesheet after Tailwind:
15
+ | Tokens | Examples | What they control |
16
+ | ---------------- | ---------------------------------------------- | ---------------------------------------------------------------- |
17
+ | Colors | `--color-surface`, `--color-primary` | Backgrounds, text, borders and states. |
18
+ | Shadows | `--shadow-control`, `--shadow-raised` | How far controls, raised panels and overlays stand off the page. |
19
+ | Shape | `--radius-sm`, `--radius-md`, `--radius-lg` | Corner radii. |
20
+ | Motion | `--mona-motion-fast`, `--mona-motion-standard` | Animation durations. |
21
+ | Materials | `--mona-effect-overlay-backdrop-filter` | Translucent, blurred backgrounds, such as Luna's glass. |
22
+ | Component tokens | `--mona-menubar-background` | Details of single components. |
16
23
 
17
- ```css
18
- @import "tailwindcss";
19
- @import "@nanahoshi/mona-ui/styles.css";
24
+ Most themes have a light and a dark variant. The theme and the variant together, such as Mona Dark, decide which tokens are in effect.
20
25
 
21
- body {
22
- background-color: var(--color-canvas);
23
- color: var(--color-foreground);
24
- }
25
- ```
26
+ ## Built-in Themes
26
27
 
27
- It does two things. It tells Tailwind to scan the package for the classes its components use, and it declares the tokens those classes name in a `@theme` block. The values there are Mona Light. Without a provider they're what you get, and without the `@theme` block a class like `bg-primary` wouldn't be generated at all.
28
+ | Theme | Variants | Look |
29
+ | ----- | ----------- | ----------------------------------------------------------------------------------- |
30
+ | Mona | Light, dark | Neutral grays, with color kept for status. The default. |
31
+ | Luna | Light, dark | Clean surfaces with a blue primary, and translucent glass on controls and overlays. |
32
+ | Anna | Light, dark | Graphite grays with a deep violet primary, and flat controls a shade lighter. |
28
33
 
29
- Any theme provider applies the theme at startup, before the first component renders. A configuration that can't be applied, such as an unknown theme name, throws during bootstrap.
34
+ [Built-in Themes](theming-built-in-themes.md) shows each one side by side, with real components.
30
35
 
31
- ```ts
36
+ ## Choose a Theme
37
+
38
+ Without any setup, Mona UI uses Mona Light. To use another theme, add `provideThemeOptions` to your application's providers, usually in `src/app/app.config.ts`:
39
+
40
+ ```typescript
41
+ import { ApplicationConfig } from "@angular/core";
32
42
  import { provideThemeOptions } from "@nanahoshi/mona-ui/theme";
33
43
 
34
- bootstrapApplication(AppComponent, {
35
- providers: [provideThemeOptions({ initialTheme: { name: "luna", variant: "system" } })]
36
- });
44
+ export const appConfig: ApplicationConfig = {
45
+ providers: [
46
+ // ...your existing providers
47
+ provideThemeOptions({ initialTheme: { name: "luna", variant: "light" } })
48
+ ]
49
+ };
37
50
  ```
38
51
 
39
- An application with no theme provider has no theme written until something injects `ThemeService`.
52
+ The theme is applied before the first component renders. A theme or variant that doesn't exist throws an error while the application starts, so a typo shows up right away.
40
53
 
41
- ---
54
+ Mona UI's stylesheet declares Mona Light's tokens for Tailwind, so its classes exist at build time and the page has colors before any code runs. An application without a theme provider keeps those values until something injects `ThemeService`.
42
55
 
43
- ## 2. Choosing a Theme
56
+ ## Switch Themes at Runtime
44
57
 
45
- Mona Light is the default. `provideThemeOptions()` chooses another, and `ThemeService.setTheme()` switches at runtime.
58
+ Inject `ThemeService` and call `setTheme()`:
46
59
 
47
- ```ts
48
- import { inject } from "@angular/core";
60
+ ```typescript
61
+ import { Component, inject } from "@angular/core";
49
62
  import { ThemeService } from "@nanahoshi/mona-ui/theme";
50
63
 
64
+ @Component({
65
+ selector: "app-appearance-settings",
66
+ templateUrl: "./appearance-settings.html"
67
+ })
51
68
  export class AppearanceSettings {
52
69
  readonly #theme = inject(ThemeService);
53
70
 
54
- protected useDark(): void {
71
+ protected useDarkMode(): void {
55
72
  this.#theme.setTheme({ name: "mona", variant: "dark" });
56
73
  }
57
74
  }
58
75
  ```
59
76
 
60
- Unknown themes and variants a theme doesn't have throw, and leave the signals and the page as they were. To offer only what exists, use `availableThemes()` to list the themes and their variants, and `supportsVariant(name, variant)` to check one.
77
+ `availableThemes()` lists the registered themes and their variants, so a menu built from it offers only what exists. In a component with `protected readonly theme = inject(ThemeService)`:
78
+
79
+ ```html
80
+ @for (option of theme.availableThemes(); track option.name) {
81
+ @for (variant of option.variants; track variant) {
82
+ <button monaButton type="button" (click)="theme.setTheme({ name: option.name, variant })">
83
+ {{ option.name }} {{ variant }}
84
+ </button>
85
+ }
86
+ }
87
+ ```
88
+
89
+ `setTheme()` throws for a theme that isn't registered, or a variant the theme doesn't have, and leaves the current theme in place. To check first, call `supportsVariant(name, variant)`.
90
+
91
+ ## Follow the System's Light or Dark Setting
92
+
93
+ Set the variant to `"system"`:
94
+
95
+ ```typescript
96
+ provideThemeOptions({ initialTheme: { name: "mona", variant: "system" } });
97
+ ```
98
+
99
+ The theme then follows the operating system's light or dark setting, and keeps following it when the setting changes. `setTheme({ name: "luna", variant: "system" })` does the same at runtime. A theme with a single variant, such as a dark-only theme of your own, uses that variant whatever the system says.
100
+
101
+ The service also sets `color-scheme` on the root element, so native controls and scrollbars match the variant.
102
+
103
+ ### Read the Current Theme
104
+
105
+ `ThemeService` reports the theme through signals, so templates and `computed()` values update when it changes:
106
+
107
+ | Signal | Value |
108
+ | ---------------- | --------------------------------------------------------------------------------------------------- |
109
+ | `preference()` | What was asked for, such as `{ name: "mona", variant: "system" }`. |
110
+ | `selection()` | What's in effect, such as `{ name: "mona", variant: "dark" }`. Its variant is always light or dark. |
111
+ | `themeName()` | The name from `selection()`. |
112
+ | `themeVariant()` | The variant from `selection()`: `"light"` or `"dark"`. |
113
+ | `profile()` | Every token in effect. |
61
114
 
62
- ### Following the system
115
+ For example, `computed(() => theme.themeVariant() === "dark")` says whether a dark variant is showing, including when it came from the system setting.
63
116
 
64
- `variant: "system"` follows the operating system's light or dark setting, and keeps following it. A theme with one variant, such as Anna, takes that variant whatever the system says.
117
+ ## Remember the User's Choice
65
118
 
66
- - `preference()` says what was asked for, which is where `"system"` shows.
67
- - `selection()`, `themeName()` and `themeVariant()` say what's in effect, so `themeVariant()` is only ever `"light"` or `"dark"`.
119
+ Give `provideThemeOptions` a `persistKey`, and `setTheme()` remembers the choice. On the next visit, it's restored in place of `initialTheme`:
68
120
 
69
- The service also sets `color-scheme` on the root, so native controls and scrollbars match the variant.
121
+ ```typescript
122
+ provideThemeOptions({
123
+ initialTheme: { name: "mona", variant: "system" },
124
+ persistKey: "app-theme"
125
+ });
126
+ ```
70
127
 
71
- ### Remembering the choice
128
+ The choice is kept in `localStorage`, as JSON, under that key. A stored value that isn't a valid choice, or names a theme that no longer exists, counts as nothing stored.
72
129
 
73
- Give `provideThemeOptions()` a `persistKey`, and `setTheme()` remembers what was chosen. It's restored in place of `initialTheme` on the next load.
130
+ To keep it somewhere else, implement `ThemeStorage` and supply it with `provideThemeStorage()`, which replaces the `THEME_STORAGE` token:
74
131
 
75
- ```ts
76
- providers: [provideThemeOptions({ initialTheme: { name: "mona", variant: "system" }, persistKey: "app-theme" })];
132
+ ```typescript
133
+ export interface ThemeStorage {
134
+ /** The stored choice, or null when there's none or this storage can't answer. */
135
+ read(key: string): ThemePreference | null;
136
+ /** Stores the choice. It must not throw. */
137
+ write(key: string, preference: ThemePreference): void;
138
+ }
77
139
  ```
78
140
 
79
- It's kept in `localStorage` as JSON by default. A stored value that isn't a preference, or names a theme that no longer exists, counts as nothing stored, and it stays in storage. It's only written when it changes. For anywhere else, implement `ThemeStorage` and supply it with `provideThemeStorage()`, or replace `THEME_STORAGE` by hand. A storage that throws doesn't stop the application, and reports an error in development.
141
+ A storage that throws anyway doesn't stop the application, and reports an error in development.
80
142
 
81
- ### Avoiding a flash on load
143
+ ## Avoid a Flash on Load
82
144
 
83
- The theme can't be applied before the application's code has loaded, so a dark theme can show the light canvas for a moment. A small script in `<head>` covers that gap. It sets the same variables the service sets, so the service overwrites them at startup and nothing has to be removed.
145
+ The theme can't be applied before the application's code has loaded, so a dark theme can show the light background for a moment. A small script in the `<head>` of `src/index.html` covers that gap. It sets the same variables as the service, which overwrites them when it starts, so nothing has to be removed later:
84
146
 
85
147
  ```html
86
148
  <script>
@@ -98,254 +160,108 @@ The theme can't be applied before the application's code has loaded, so a dark t
98
160
  </script>
99
161
  ```
100
162
 
101
- Use your own key and your theme's canvas colors. The values above are Mona's. A Content Security Policy has to allow this inline script, by hash or nonce.
163
+ Use your own `persistKey` and your theme's canvas colors. The values above are Mona's. If your site has a Content Security Policy, it has to allow this inline script, by hash or nonce.
102
164
 
103
- ### Server rendering
165
+ ## Server-Side Rendering
104
166
 
105
- `localStorage` can't answer on the server, so a server-rendered application gets `initialTheme` in its markup and the remembered theme on hydration. A storage the server can read too, such as a cookie, avoids that. Supply it with a factory, which runs in an injection context, where `CookieThemeStorage` is a class of your own:
167
+ `localStorage` isn't available on the server, so a server-rendered page shows `initialTheme` until the browser takes over and restores the remembered theme. A storage the server can read too, such as a cookie, avoids that switch. Supply it with a factory, which runs in an injection context, so it can inject the request. Here `CookieThemeStorage` is a class of your own:
106
168
 
107
- ```ts
169
+ ```typescript
108
170
  providers: [provideThemeStorage(() => new CookieThemeStorage(inject(REQUEST)))];
109
171
  ```
110
172
 
111
- Luna also changes on hydration in any case, because `backdrop-filter` support can only be read in a browser: the server renders its reduced material, and the client switches to the full one.
112
-
113
- ---
114
-
115
- ## 3. Color Roles
116
-
117
- Mona's colors describe intent instead of a specific component:
118
-
119
- - `canvas` is the application backdrop; `surface` is the normal content plane.
120
- - `surface-raised` contains controls and elevated regions; `surface-overlay` is reserved for menus, popups, and dialogs.
121
- - `input-background` and the control-border tokens give form fields, buttons and other outlined controls a quiet boundary, so they match side by side. It's below the 3:1 of WCAG 1.4.11 unless the user asks for more contrast, as [Contrast and Forced Colors](#10-contrast-and-forced-colors) explains. Hover changes a field's border, and focus and invalid states add their own cue.
122
- - `hover` and `active` are neutral, temporary interaction feedback.
123
- - `accent` is persistent selection and keyboard highlighting. Mona's built-in accent is a quiet zinc tone rather than a competing hue.
124
- - `primary` is the stronger action color used by prominent buttons, links, and focus indicators. It is near-black in Mona Light and near-white in Mona Dark.
125
-
126
- This separation lets the same textbox work on a page or inside a dropdown without turning every hover state into brand color. The built-in palette is monochrome except for success, error, warning, and info, where color communicates meaning.
127
-
128
- Not all of these reach a component through a named utility. Slider ranges, progress, switches, radio dots, tab bars and steps use an optional `--mona-indicator-color`, with `--mona-indicator-foreground` for what sits on it. Both fall back to the primary pair, and a theme sets them through `custom`. Anna uses them to keep its violet under labels while its fills use a lighter tone with 3:1 against the surface.
129
-
130
- ---
131
-
132
- ## 4. A Palette from Brand Colors
133
-
134
- Use `provideThemeColorPalette()` for a contrast-fitted light and dark palette. Only `primary` is required. Optional seeds replace their own role; an omitted secondary or status seed keeps Mona's built-in value.
135
-
136
- ```ts
137
- import { provideThemeColorPalette } from "@nanahoshi/mona-ui/theme";
138
-
139
- bootstrapApplication(AppComponent, {
140
- providers: [
141
- provideThemeColorPalette({
142
- theme: "mona",
143
- seeds: {
144
- primary: "#7444c3",
145
- secondary: "hsl(212 27% 39%)",
146
- success: "oklch(62% 0.14 150)",
147
- error: "rgb(194 65 59)",
148
- warning: "#b36b00",
149
- info: "oklch(60% 0.15 255)"
150
- }
151
- })
152
- ]
153
- });
154
- ```
155
-
156
- Seeds may use opaque CSS Color Level 4 syntax, including hex, RGB, HSL, and OKLCH. Seed hue and chroma establish identity; Mona generates variant-aware tones and adjusts lightness and chroma when required for WCAG contrast and sRGB gamut. Invalid or translucent seeds throw a role-specific configuration error.
157
-
158
- You can also call `generateThemeColorPalette()` directly when you need to inspect the immutable light and dark color maps before registration.
159
-
160
- ---
161
-
162
- ## 5. Explicit Overrides
163
-
164
- Register application-wide color additions and overrides in your root bootstrap providers:
173
+ Luna changes on hydration in any case, because only a browser can say whether it supports `backdrop-filter`. The server renders its opaque materials, and the browser switches to the translucent ones.
165
174
 
166
- ```ts
167
- import { provideThemeOverrides } from "@nanahoshi/mona-ui/theme";
175
+ ## Use Theme Tokens in Your Own Styles
168
176
 
169
- bootstrapApplication(AppComponent, {
170
- providers: [
171
- provideThemeOverrides({
172
- theme: "mona",
173
- common: {
174
- colors: {
175
- "--color-brand": "oklch(62% 0.18 280)"
176
- }
177
- },
178
- light: {
179
- colors: {
180
- "--color-primary": "oklch(48% 0.16 280)",
181
- "--color-primary-foreground": "white"
182
- }
183
- },
184
- dark: {
185
- colors: {
186
- "--color-primary": "oklch(72% 0.14 280)",
187
- "--color-primary-foreground": "oklch(18% 0.02 280)"
188
- }
189
- }
190
- })
191
- ]
192
- });
193
- ```
194
-
195
- `common` values apply to light and dark variants. Variant-specific values override `common` values. You can register the helper more than once; later providers override earlier providers while preserving unrelated values.
196
-
197
- Generated palettes use the same ordered provider pipeline. Place `provideThemeOverrides()` after `provideThemeColorPalette()` to fine-tune any generated token:
177
+ Your own components can use the same tokens, so they follow the theme too. Mona UI's stylesheet registers them with Tailwind, so they work as classes:
198
178
 
199
- ```ts
200
- providers: [
201
- provideThemeColorPalette({ theme: "mona", seeds: { primary: "#7444c3" } }),
202
- provideThemeOverrides({
203
- theme: "mona",
204
- dark: { colors: { "--color-primary": "oklch(74% 0.14 308.49)" } }
205
- })
206
- ];
179
+ ```html
180
+ <section class="rounded-lg border border-border bg-surface p-4 text-foreground shadow-raised">
181
+ <h2 class="font-semibold">Storage</h2>
182
+ <p class="text-muted-foreground">You've used 70% of your plan.</p>
183
+ </section>
207
184
  ```
208
185
 
209
- Theme registrations are static root-level configuration. They customize the global theme written by `ThemeService`; component-level providers do not create independently scoped themes.
210
-
211
- ---
212
-
213
- ## 6. Brand Colors at Runtime
186
+ The tokens you'll use most:
214
187
 
215
- Inject `ThemeService` when the application user can choose a brand color after bootstrap. A single primary seed regenerates all related semantic roles and updates the root variables immediately:
188
+ | Purpose | Classes |
189
+ | -------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
190
+ | Page background | `bg-canvas` |
191
+ | Content background | `bg-surface`, `bg-surface-muted` |
192
+ | Raised panels and overlays | `bg-surface-raised`, `bg-surface-overlay` |
193
+ | Text | `text-foreground`, `text-muted-foreground` |
194
+ | Borders | `border-border`, `border-border-subtle` |
195
+ | Main action | `bg-primary text-primary-foreground` |
196
+ | Status | `bg-error text-error-foreground`, `bg-success-subtle text-success-subtle-foreground`, and the same for `warning` and `info` |
197
+ | Hover and pressed | `hover:bg-hover`, `active:bg-active` |
198
+ | Shadows | `shadow-control`, `shadow-raised`, `shadow-overlay` |
199
+ | Corners | `rounded-sm`, `rounded-md`, `rounded-lg` |
216
200
 
217
- ```ts
218
- import { inject } from "@angular/core";
219
- import { ThemeService } from "@nanahoshi/mona-ui/theme";
201
+ Use a background with its matching foreground, such as `bg-primary` with `text-primary-foreground`. Each theme makes those pairs readable together. [Color Roles](theming-custom-colors.md#color-roles) explains what each color is for, and [Theme Colors](theming-colors.md) shows them in the current theme, with their contrast.
220
202
 
221
- export class AppearanceSettings {
222
- readonly #theme = inject(ThemeService);
203
+ In plain CSS, read the variables directly:
223
204
 
224
- protected usePrimaryColor(color: string): void {
225
- this.#theme.setPrimaryColor(color);
226
- }
227
-
228
- protected restoreConfiguredPalette(): void {
229
- this.#theme.clearColorPalette();
230
- }
205
+ ```css
206
+ .storage-note {
207
+ color: var(--color-muted-foreground);
208
+ transition: opacity var(--mona-motion-fast);
231
209
  }
232
210
  ```
233
211
 
234
- Use `setColorPalette()` when users can customize more roles:
235
-
236
- ```ts
237
- themeService.setColorPalette({
238
- primary: "#3f6be2",
239
- secondary: "#526070",
240
- success: "#287a4b"
241
- });
242
- ```
243
-
244
- The runtime palette is applied after registered profiles and provider overrides. It remains active when `setTheme()` switches families or variants, using its generated light or dark tones as appropriate. `clearColorPalette()` restores the provider-resolved palette. `colorPaletteSeeds` is a readonly signal for displaying the current runtime choice.
245
-
246
- Runtime updates are atomic: invalid or translucent colors throw before the active profile, signals, or root styles change. `persistKey` remembers the theme, not the palette. To keep a runtime palette, save its seeds in your own settings store and apply them again at startup.
247
-
248
- A seed gives a hue and a chroma, and Mona chooses the lightness each role needs for contrast. `setPrimaryColor("#fff")` and `setPrimaryColor("#000")` come to the same color, so a palette can't reproduce an exact brand color. To use one, set it with `provideThemeOverrides()`, and check its contrast yourself.
249
-
250
- ---
212
+ ### Style Light and Dark Differently
251
213
 
252
- ## 7. Registering a Theme
214
+ The tokens already change with the variant, so most styles need nothing more. For the rest, the theme service sets these attributes on the root element:
253
215
 
254
- Custom families provide one or both variants. Every declared variant is a complete, independent `ThemeProfile` with `colors`, `shadows`, `motion`, `effects`, `shape`, and `components` sections. The only optional tokens are the two contrast border colors in [Contrast and Forced Colors](#10-contrast-and-forced-colors):
216
+ | Attribute | Value |
217
+ | ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ |
218
+ | `data-mona-theme` | The theme's name, such as `mona`. |
219
+ | `data-mona-variant` | `light` or `dark`. |
220
+ | `data-mona-transparency` | `full`, or `reduced` when materials are opaque because the browser has no `backdrop-filter` or the user asked for less transparency. |
255
221
 
256
- ```ts
257
- import { provideThemeFamily, type ThemeFamilyRegistration } from "@nanahoshi/mona-ui/theme";
258
- import { auroraDarkProfile } from "./aurora-dark-profile";
259
-
260
- const auroraTheme = {
261
- name: "aurora",
262
- variants: { dark: auroraDarkProfile }
263
- } satisfies ThemeFamilyRegistration;
264
-
265
- providers: [provideThemeFamily(auroraTheme)];
266
- ```
267
-
268
- The profile must declare the full canonical token contract. The required `effects` section defines control, raised, and overlay materials, including opaque fallbacks; `shape` defines the shared small, medium, and large radius scale. Optional custom variables may not collide with required profile variables. Mona UI automatically substitutes effect fallbacks when backdrop filtering is unavailable or reduced transparency is requested.
269
-
270
- ### Using New Color Names with Tailwind
271
-
272
- Registering `--color-brand` creates the runtime CSS variable, but Tailwind discovers named utilities at build time. To generate utilities such as `bg-brand`, declare the token in your application's `@theme` block:
222
+ Tailwind's `dark:` variant follows the operating system, not the theme. To make it follow the theme, add this line to your global stylesheet, after the imports:
273
223
 
274
224
  ```css
275
- @theme {
276
- --color-brand: transparent;
277
- }
225
+ @custom-variant dark (&:where([data-mona-variant="dark"], [data-mona-variant="dark"] *));
278
226
  ```
279
227
 
280
- Alternatively, use `bg-(--color-brand)` or ordinary CSS such as `color: var(--color-brand)` without adding a named Tailwind token.
281
-
282
- A custom theme can start from a built-in one, since `monaTheme`, `lunaTheme`, `annaTheme` and `builtInThemes` are exported. A strategy can wrap `DefaultThemeStrategy`, and a custom one can report its themes through an optional `availableThemes()`. Without it, `ThemeService.availableThemes()` is empty.
283
-
284
- ### What's checked
285
-
286
- A name with whitespace, a duplicate theme, a theme with no variants, and an override for a theme or variant that doesn't exist all throw when the application starts.
287
-
288
- In development, custom themes and overrides are also checked, and each problem logs a warning:
289
-
290
- - A value that isn't a color.
291
- - A custom variable without `--`.
292
- - A main pair below what AA needs: 4.5:1 for `--color-foreground` and `--color-muted-foreground` on `--color-surface`, `--color-input-foreground` on `--color-input-background`, and `--color-primary-foreground` on `--color-primary`, and 3:1 for `--color-focus-indicator` and `--color-selected-border` on `--color-surface`, and for `--color-border-control-contrast` and `--color-border-control-contrast-hover` on `--color-input-background` when a theme sets them.
228
+ Classes such as `dark:invert` then apply whenever a dark variant is in effect, including one chosen by the system setting.
293
229
 
294
- Values it can't read, such as `color-mix()`, aren't reported, because they may well be right.
230
+ ## Theme Part of a Page
295
231
 
296
- ---
232
+ By default, the theme is written to `<html>`. For an application embedded in a larger page, `provideThemeRoot()` writes it to an element of your own instead, by setting the `THEME_ROOT` token. The element, or a factory that returns it, has to exist when the application starts:
297
233
 
298
- ## 8. Theming Part of a Page
299
-
300
- `provideThemeRoot()` writes the theme to an element in place of `<html>`, for an application embedded in a larger page. It sets `THEME_ROOT`, which defaults to `<html>`. The element, or a factory for it, has to exist at startup.
301
-
302
- ```ts
234
+ ```typescript
303
235
  providers: [provideThemeRoot(() => document.getElementById("app-shell"))];
304
236
  ```
305
237
 
306
- - Overlays render outside that element, so the overlay container gets the theme too. It gets it a moment after startup, because the overlay module loads on demand, and an overlay opened before that gets its colors when it arrives.
307
- - Only what's in the overlay container follows. A full-page spinner sits on `body`, so it keeps the page's own colors.
308
- - Charts inside the element follow a switch.
309
-
310
- ### One writer for each element
311
-
312
- Only one service should write to an element. If two do, the later one owns it: it warns in development, and the earlier one's `selection()` stops being true. Give each application its own element with `provideThemeRoot()`.
313
-
314
- A theme is written once per application. Component-level providers don't create a theme of their own.
315
-
316
- When the application's injector is destroyed, the service removes the variables and the `data-mona-*` attributes it wrote, and `color-scheme` with them.
238
+ - Overlays, such as popups and dialogs, render outside that element, so their container gets the theme too. It arrives shortly after startup, because the overlay code loads on demand. An overlay opened before then takes its colors when it does.
239
+ - Only what's in the overlay container follows the theme. A full-page spinner sits on `body`, so it keeps the page's own colors.
240
+ - Only one application should write to an element. If two do, the later one takes over and warns in development. Give each application its own element.
317
241
 
318
- ---
242
+ When the application is destroyed, the service removes the variables, the `data-mona-*` attributes and `color-scheme` it wrote.
319
243
 
320
- ## 9. Attributes on the Root
244
+ ## Accessibility
321
245
 
322
- | Attribute | Value |
323
- | ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------- |
324
- | `data-mona-theme` | The theme's name. |
325
- | `data-mona-variant` | `light` or `dark`. |
326
- | `data-mona-transparency` | `full`, or `reduced` when materials are opaque, because the browser has no `backdrop-filter` or the user asked for less transparency. |
246
+ The built-in themes meet WCAG AA contrast, with one deliberate exception. A form field's border is quiet by default, below the 3:1 that WCAG 1.4.11 asks for, so fields don't crowd the page. Hover changes the border, and focus and invalid states add a cue of their own.
327
247
 
328
- ---
248
+ When the user asks for more contrast, with the operating system's setting that sets `prefers-contrast: more`, the border of fields, buttons and other controls rises to at least 3:1 on every surface, and a slider's track gains a border. If your application has to meet 1.4.11 for every user, give the borders 3:1 in a [custom theme](theming-custom-themes.md#contrast-borders).
329
249
 
330
- ## 10. Contrast and Forced Colors
250
+ In forced colors mode, such as Windows' contrast themes, the browser replaces most colors, and box shadows and many backgrounds aren't drawn. When you style components yourself or build on the tokens:
331
251
 
332
- The built-in themes meet WCAG AA with one deliberate exception. A field's border is quiet by default, below the 3:1 that WCAG 1.4.11 asks for, so a field whose background matches its surface is harder to make out.
333
-
334
- When the user asks for more contrast (`prefers-contrast: more`), the theme service replaces `--color-border-control` and `--color-border-control-hover` with `--color-border-control-contrast` and `--color-border-control-contrast-hover`, which are at least 3:1 on every surface, and a slider's track gains a border. Everything that shares those tokens follows, including buttons, chips and chart gridlines. A custom theme without the contrast tokens keeps its own border. If it sets them, the development check warns when they're below 3:1. If your application has to meet 1.4.11 for everyone, set `--color-border-control` and `--color-border-control-hover` to at least 3:1 in a custom theme.
335
-
336
- A spec checks the rest: text is 4.5:1, and focus indicators, selected borders, chart colors and scrollbar thumbs are 3:1.
337
-
338
- In forced colors the browser replaces most of these colors, and rings and many backgrounds don't paint. When you add your own styles to a component or build on the tokens:
339
-
340
- - Pair `outline-none` with `focus-visible:outline-hidden`, which draws an outline there and nothing elsewhere.
252
+ - Pair `outline-none` with `focus-visible:outline-hidden`, which draws an outline in forced colors and nothing elsewhere.
341
253
  - Give a state drawn only by a background `forced-colors:bg-[Highlight]`.
342
- - Where the color is the content, or text sits on it, use `forced-color-adjust-none`. Otherwise the browser paints a Canvas backplate behind the text, which can leave it white on white.
343
-
344
- ---
254
+ - Where the color is the content, such as a swatch, or text sits on a color, add `forced-color-adjust-none`. Otherwise the browser paints a backplate behind the text, which can leave it white on white.
345
255
 
346
- ## 11. Replacing Profile Resolution
256
+ ## Customize Further
347
257
 
348
- Advanced integrations can provide their own `ThemeStrategy` through `THEME_STRATEGY`. Most applications should use the family and override providers instead.
258
+ | To | Use | See |
259
+ | ------------------------------------------------------------- | -------------------------------- | ---------------------------------------------------------------------------------- |
260
+ | Generate a palette from your brand colors | `provideThemeColorPalette()` | [Custom Colors](theming-custom-colors.md) |
261
+ | Change specific tokens, such as one color or the corner radii | `provideThemeOverrides()` | [Custom Colors](theming-custom-colors.md#override-specific-tokens) |
262
+ | Let users choose a color | `ThemeService.setPrimaryColor()` | [Custom Colors](theming-custom-colors.md#let-users-choose-a-color) |
263
+ | Register a theme of your own | `provideThemeFamily()` | [Custom Themes](theming-custom-themes.md) |
264
+ | Decide yourself how themes resolve to tokens | The `THEME_STRATEGY` token | [Custom Themes](theming-custom-themes.md#replace-how-themes-are-resolved) |
349
265
 
350
266
  ## API
351
267