@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.
- package/docs/api/chart.md +2 -2
- package/docs/api/locales.md +8 -0
- package/docs/api/popup.md +1 -1
- package/docs/api/theme.md +2 -2
- package/docs/chart.md +14 -0
- package/docs/editor.md +2 -0
- package/docs/installation.md +147 -15
- package/docs/introduction.md +37 -15
- package/docs/theming-built-in-themes.md +67 -0
- package/docs/theming-custom-colors.md +274 -0
- package/docs/theming-custom-themes.md +168 -0
- package/docs/theming.md +164 -248
- package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +1089 -603
- package/fesm2022/nanahoshi-mona-ui-avatar.mjs +369 -184
- package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +658 -371
- package/fesm2022/nanahoshi-mona-ui-button-group.mjs +513 -359
- package/fesm2022/nanahoshi-mona-ui-button.mjs +622 -517
- package/fesm2022/nanahoshi-mona-ui-calendar.mjs +2071 -1573
- package/fesm2022/nanahoshi-mona-ui-card.mjs +620 -316
- package/fesm2022/nanahoshi-mona-ui-chart.mjs +61151 -64921
- package/fesm2022/nanahoshi-mona-ui-check-box.mjs +646 -317
- package/fesm2022/nanahoshi-mona-ui-chip.mjs +737 -516
- package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +441 -242
- package/fesm2022/nanahoshi-mona-ui-collapsible.mjs +443 -390
- package/fesm2022/nanahoshi-mona-ui-color-gradient.mjs +1138 -814
- package/fesm2022/nanahoshi-mona-ui-color-palette.mjs +1114 -959
- package/fesm2022/nanahoshi-mona-ui-color-picker.mjs +858 -504
- package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +1181 -742
- package/fesm2022/nanahoshi-mona-ui-command.mjs +1454 -853
- package/fesm2022/nanahoshi-mona-ui-common.mjs +569 -743
- package/fesm2022/nanahoshi-mona-ui-contextmenu.mjs +978 -532
- package/fesm2022/nanahoshi-mona-ui-date-input.mjs +283 -266
- package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +973 -451
- package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +1203 -658
- package/fesm2022/nanahoshi-mona-ui-dialog.mjs +1415 -936
- package/fesm2022/nanahoshi-mona-ui-dropdown-button.mjs +1165 -568
- package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +1142 -677
- package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +1018 -734
- package/fesm2022/nanahoshi-mona-ui-editor.mjs +3589 -2122
- package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +577 -359
- package/fesm2022/nanahoshi-mona-ui-fieldset.mjs +311 -151
- package/fesm2022/nanahoshi-mona-ui-filter.mjs +1086 -718
- package/fesm2022/nanahoshi-mona-ui-grid-grid-colgroup.component-NhONCVIX.mjs +77 -0
- package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-row.component-Djv8ZnT5.mjs +480 -0
- package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-WbXAzGCa.mjs +470 -0
- package/fesm2022/nanahoshi-mona-ui-grid-grid-row.component-DkWTD3pN.mjs +2115 -0
- package/fesm2022/nanahoshi-mona-ui-grid-grid-virtual-list.component-DAHqTwBJ.mjs +330 -0
- package/fesm2022/nanahoshi-mona-ui-grid-grid.styles-BmLU-3zP.mjs +3766 -0
- package/fesm2022/nanahoshi-mona-ui-grid.mjs +5418 -2
- package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +1379 -1079
- package/fesm2022/nanahoshi-mona-ui-i18n.mjs +4451 -5077
- package/fesm2022/nanahoshi-mona-ui-internal-filter-input.mjs +344 -143
- package/fesm2022/nanahoshi-mona-ui-internal-indicator-icon.mjs +257 -127
- package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +2080 -1829
- package/fesm2022/nanahoshi-mona-ui-internal-popup-menu.mjs +103 -141
- package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +2498 -2706
- package/fesm2022/nanahoshi-mona-ui-internal.mjs +722 -1007
- package/fesm2022/nanahoshi-mona-ui-label.mjs +313 -202
- package/fesm2022/nanahoshi-mona-ui-list-box.mjs +1308 -1009
- package/fesm2022/nanahoshi-mona-ui-list-view.mjs +1411 -677
- package/fesm2022/nanahoshi-mona-ui-list.mjs +1 -6
- package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +556 -577
- package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +530 -573
- package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +530 -573
- package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +533 -576
- package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +520 -555
- package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +530 -571
- package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +520 -555
- package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +520 -555
- package/fesm2022/nanahoshi-mona-ui-locales-pl-pl.mjs +599 -0
- package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +530 -571
- package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +576 -591
- package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +530 -565
- package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +520 -555
- package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +520 -555
- package/fesm2022/nanahoshi-mona-ui-locales.mjs +61 -77
- package/fesm2022/nanahoshi-mona-ui-menubar.mjs +1411 -829
- package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +1326 -702
- package/fesm2022/nanahoshi-mona-ui-notification.mjs +763 -675
- package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +1306 -826
- package/fesm2022/nanahoshi-mona-ui-otp-input.mjs +1122 -897
- package/fesm2022/nanahoshi-mona-ui-pager.mjs +1110 -651
- package/fesm2022/nanahoshi-mona-ui-placeholder.mjs +95 -53
- package/fesm2022/nanahoshi-mona-ui-popover.mjs +559 -397
- package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +2323 -1694
- package/fesm2022/nanahoshi-mona-ui-popup.mjs +1657 -1455
- package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +441 -267
- package/fesm2022/nanahoshi-mona-ui-query.mjs +211 -340
- package/fesm2022/nanahoshi-mona-ui-radio-button.mjs +1017 -548
- package/fesm2022/nanahoshi-mona-ui-rating.mjs +874 -624
- package/fesm2022/nanahoshi-mona-ui-scroll-view.mjs +1130 -917
- package/fesm2022/nanahoshi-mona-ui-segmented.mjs +705 -455
- package/fesm2022/nanahoshi-mona-ui-sheet.mjs +461 -283
- package/fesm2022/nanahoshi-mona-ui-sidebar.mjs +2791 -2449
- package/fesm2022/nanahoshi-mona-ui-skeleton.mjs +145 -90
- package/fesm2022/nanahoshi-mona-ui-slider.mjs +1563 -1103
- package/fesm2022/nanahoshi-mona-ui-spinner.mjs +738 -673
- package/fesm2022/nanahoshi-mona-ui-split-button.mjs +1287 -647
- package/fesm2022/nanahoshi-mona-ui-splitter.mjs +1313 -909
- package/fesm2022/nanahoshi-mona-ui-stepper.mjs +761 -540
- package/fesm2022/nanahoshi-mona-ui-switch.mjs +611 -280
- package/fesm2022/nanahoshi-mona-ui-tabs.mjs +1393 -841
- package/fesm2022/nanahoshi-mona-ui-text-area.mjs +142 -73
- package/fesm2022/nanahoshi-mona-ui-text-box.mjs +876 -374
- package/fesm2022/nanahoshi-mona-ui-theme.mjs +1465 -1449
- package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +897 -443
- package/fesm2022/nanahoshi-mona-ui-time-selector.mjs +1100 -703
- package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +789 -538
- package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +1361 -805
- package/fesm2022/nanahoshi-mona-ui-window.mjs +2145 -1531
- package/fesm2022/nanahoshi-mona-ui.mjs +1 -8
- package/llms.txt +7 -3
- package/locales/pl-pl/package.json +4 -0
- package/locales/pl-pl/pl-pl.messages.json +536 -0
- package/package.json +66 -23
- package/types/nanahoshi-mona-ui-auto-complete.d.ts +367 -233
- package/types/nanahoshi-mona-ui-avatar.d.ts +722 -649
- package/types/nanahoshi-mona-ui-breadcrumb.d.ts +134 -103
- package/types/nanahoshi-mona-ui-button-group.d.ts +213 -152
- package/types/nanahoshi-mona-ui-button.d.ts +227 -166
- package/types/nanahoshi-mona-ui-calendar.d.ts +324 -259
- package/types/nanahoshi-mona-ui-card.d.ts +125 -111
- package/types/nanahoshi-mona-ui-chart.d.ts +10483 -7326
- package/types/nanahoshi-mona-ui-check-box.d.ts +293 -180
- package/types/nanahoshi-mona-ui-chip.d.ts +208 -141
- package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +194 -133
- package/types/nanahoshi-mona-ui-collapsible.d.ts +103 -87
- package/types/nanahoshi-mona-ui-color-gradient.d.ts +281 -213
- package/types/nanahoshi-mona-ui-color-palette.d.ts +201 -138
- package/types/nanahoshi-mona-ui-color-picker.d.ts +283 -194
- package/types/nanahoshi-mona-ui-combo-box.d.ts +401 -262
- package/types/nanahoshi-mona-ui-command.d.ts +279 -191
- package/types/nanahoshi-mona-ui-common.d.ts +354 -385
- package/types/nanahoshi-mona-ui-contextmenu.d.ts +142 -117
- package/types/nanahoshi-mona-ui-date-input.d.ts +79 -96
- package/types/nanahoshi-mona-ui-date-picker.d.ts +338 -208
- package/types/nanahoshi-mona-ui-datetime-picker.d.ts +413 -259
- package/types/nanahoshi-mona-ui-dialog.d.ts +470 -381
- package/types/nanahoshi-mona-ui-dropdown-button.d.ts +216 -168
- package/types/nanahoshi-mona-ui-dropdown-list.d.ts +369 -243
- package/types/nanahoshi-mona-ui-dropdowns.d.ts +231 -217
- package/types/nanahoshi-mona-ui-editor.d.ts +302 -235
- package/types/nanahoshi-mona-ui-expansion-panel.d.ts +140 -109
- package/types/nanahoshi-mona-ui-fieldset.d.ts +98 -68
- package/types/nanahoshi-mona-ui-filter.d.ts +150 -124
- package/types/nanahoshi-mona-ui-grid.d.ts +1956 -1678
- package/types/nanahoshi-mona-ui-i18n-icu.d.ts +25 -34
- package/types/nanahoshi-mona-ui-i18n.d.ts +987 -1052
- package/types/nanahoshi-mona-ui-internal-filter-input.d.ts +118 -71
- package/types/nanahoshi-mona-ui-internal-indicator-icon.d.ts +56 -27
- package/types/nanahoshi-mona-ui-internal-list.d.ts +474 -408
- package/types/nanahoshi-mona-ui-internal-popup-menu.d.ts +143 -150
- package/types/nanahoshi-mona-ui-internal-tree.d.ts +493 -506
- package/types/nanahoshi-mona-ui-internal.d.ts +195 -213
- package/types/nanahoshi-mona-ui-label.d.ts +108 -78
- package/types/nanahoshi-mona-ui-list-box.d.ts +392 -322
- package/types/nanahoshi-mona-ui-list-view.d.ts +423 -282
- package/types/nanahoshi-mona-ui-list.d.ts +2 -1
- package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +540 -542
- package/types/nanahoshi-mona-ui-locales-de-de.d.ts +540 -542
- package/types/nanahoshi-mona-ui-locales-es-es.d.ts +540 -542
- package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +540 -542
- package/types/nanahoshi-mona-ui-locales-id-id.d.ts +540 -542
- package/types/nanahoshi-mona-ui-locales-it-it.d.ts +540 -542
- package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +540 -542
- package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +540 -542
- package/types/nanahoshi-mona-ui-locales-pl-pl.d.ts +540 -0
- package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +540 -542
- package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +540 -542
- package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +540 -542
- package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +540 -542
- package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +540 -542
- package/types/nanahoshi-mona-ui-locales.d.ts +18 -19
- package/types/nanahoshi-mona-ui-menubar.d.ts +210 -181
- package/types/nanahoshi-mona-ui-multi-select.d.ts +416 -276
- package/types/nanahoshi-mona-ui-notification.d.ts +140 -151
- package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +407 -270
- package/types/nanahoshi-mona-ui-otp-input.d.ts +364 -241
- package/types/nanahoshi-mona-ui-pager.d.ts +379 -301
- package/types/nanahoshi-mona-ui-placeholder.d.ts +35 -28
- package/types/nanahoshi-mona-ui-popover.d.ts +176 -134
- package/types/nanahoshi-mona-ui-popup-menu.d.ts +488 -344
- package/types/nanahoshi-mona-ui-popup.d.ts +698 -560
- package/types/nanahoshi-mona-ui-progress-bar.d.ts +197 -137
- package/types/nanahoshi-mona-ui-query.d.ts +82 -88
- package/types/nanahoshi-mona-ui-radio-button.d.ts +434 -269
- package/types/nanahoshi-mona-ui-rating.d.ts +348 -254
- package/types/nanahoshi-mona-ui-scroll-view.d.ts +244 -172
- package/types/nanahoshi-mona-ui-segmented.d.ts +250 -175
- package/types/nanahoshi-mona-ui-sheet.d.ts +115 -63
- package/types/nanahoshi-mona-ui-sidebar.d.ts +653 -493
- package/types/nanahoshi-mona-ui-skeleton.d.ts +55 -39
- package/types/nanahoshi-mona-ui-slider.d.ts +503 -354
- package/types/nanahoshi-mona-ui-spinner.d.ts +125 -112
- package/types/nanahoshi-mona-ui-split-button.d.ts +241 -196
- package/types/nanahoshi-mona-ui-splitter.d.ts +124 -78
- package/types/nanahoshi-mona-ui-stepper.d.ts +206 -181
- package/types/nanahoshi-mona-ui-switch.d.ts +197 -131
- package/types/nanahoshi-mona-ui-tabs.d.ts +349 -248
- package/types/nanahoshi-mona-ui-text-area.d.ts +52 -36
- package/types/nanahoshi-mona-ui-text-box.d.ts +349 -218
- package/types/nanahoshi-mona-ui-theme.d.ts +415 -408
- package/types/nanahoshi-mona-ui-time-picker.d.ts +357 -217
- package/types/nanahoshi-mona-ui-time-selector.d.ts +255 -170
- package/types/nanahoshi-mona-ui-tooltip.d.ts +222 -144
- package/types/nanahoshi-mona-ui-tree-view.d.ts +466 -308
- package/types/nanahoshi-mona-ui-window.d.ts +494 -399
- package/types/nanahoshi-mona-ui.d.ts +1 -2
- package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-row.component-DjNnVxHE.mjs +0 -181
- package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-ihQIKeP-.mjs +0 -208
- package/fesm2022/nanahoshi-mona-ui-grid-grid-row.component-BpnybNcs.mjs +0 -1082
- package/fesm2022/nanahoshi-mona-ui-grid-grid-virtual-list.component-CYlgfc7c.mjs +0 -186
- 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
|
-
>
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
13
|
+
A theme defines these kinds of tokens:
|
|
14
14
|
|
|
15
|
-
|
|
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
|
-
|
|
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
|
-
|
|
22
|
-
background-color: var(--color-canvas);
|
|
23
|
-
color: var(--color-foreground);
|
|
24
|
-
}
|
|
25
|
-
```
|
|
26
|
+
## Built-in Themes
|
|
26
27
|
|
|
27
|
-
|
|
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
|
-
|
|
34
|
+
[Built-in Themes](theming-built-in-themes.md) shows each one side by side, with real components.
|
|
30
35
|
|
|
31
|
-
|
|
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
|
-
|
|
35
|
-
providers: [
|
|
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
|
-
|
|
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
|
-
##
|
|
56
|
+
## Switch Themes at Runtime
|
|
44
57
|
|
|
45
|
-
|
|
58
|
+
Inject `ThemeService` and call `setTheme()`:
|
|
46
59
|
|
|
47
|
-
```
|
|
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
|
|
71
|
+
protected useDarkMode(): void {
|
|
55
72
|
this.#theme.setTheme({ name: "mona", variant: "dark" });
|
|
56
73
|
}
|
|
57
74
|
}
|
|
58
75
|
```
|
|
59
76
|
|
|
60
|
-
|
|
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
|
-
|
|
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
|
-
|
|
117
|
+
## Remember the User's Choice
|
|
65
118
|
|
|
66
|
-
|
|
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
|
-
|
|
121
|
+
```typescript
|
|
122
|
+
provideThemeOptions({
|
|
123
|
+
initialTheme: { name: "mona", variant: "system" },
|
|
124
|
+
persistKey: "app-theme"
|
|
125
|
+
});
|
|
126
|
+
```
|
|
70
127
|
|
|
71
|
-
|
|
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
|
-
|
|
130
|
+
To keep it somewhere else, implement `ThemeStorage` and supply it with `provideThemeStorage()`, which replaces the `THEME_STORAGE` token:
|
|
74
131
|
|
|
75
|
-
```
|
|
76
|
-
|
|
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
|
-
|
|
141
|
+
A storage that throws anyway doesn't stop the application, and reports an error in development.
|
|
80
142
|
|
|
81
|
-
|
|
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
|
|
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
|
|
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
|
-
|
|
165
|
+
## Server-Side Rendering
|
|
104
166
|
|
|
105
|
-
`localStorage`
|
|
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
|
-
```
|
|
169
|
+
```typescript
|
|
108
170
|
providers: [provideThemeStorage(() => new CookieThemeStorage(inject(REQUEST)))];
|
|
109
171
|
```
|
|
110
172
|
|
|
111
|
-
Luna
|
|
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
|
-
|
|
167
|
-
import { provideThemeOverrides } from "@nanahoshi/mona-ui/theme";
|
|
175
|
+
## Use Theme Tokens in Your Own Styles
|
|
168
176
|
|
|
169
|
-
|
|
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
|
-
```
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
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
|
-
|
|
210
|
-
|
|
211
|
-
---
|
|
212
|
-
|
|
213
|
-
## 6. Brand Colors at Runtime
|
|
186
|
+
The tokens you'll use most:
|
|
214
187
|
|
|
215
|
-
|
|
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
|
-
|
|
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
|
-
|
|
222
|
-
readonly #theme = inject(ThemeService);
|
|
203
|
+
In plain CSS, read the variables directly:
|
|
223
204
|
|
|
224
|
-
|
|
225
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
@
|
|
276
|
-
--color-brand: transparent;
|
|
277
|
-
}
|
|
225
|
+
@custom-variant dark (&:where([data-mona-variant="dark"], [data-mona-variant="dark"] *));
|
|
278
226
|
```
|
|
279
227
|
|
|
280
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
-
|
|
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
|
-
##
|
|
244
|
+
## Accessibility
|
|
321
245
|
|
|
322
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
##
|
|
256
|
+
## Customize Further
|
|
347
257
|
|
|
348
|
-
|
|
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
|
|