Theme context: applies the chosen base mode + accent to <html> and keeps
them live. Mirrors the i18n provider — the App owns the persisted values
(settings.themeMode / settings.accent) and the user-theme list, and passes
them in. Consumers (the ThemePicker) read the merged theme registry + actions
via useTheme().
system mode follows the OS (a matchMedia listener re-applies live). User
themes are merged over the built-ins (override by id / add new) and applied at
runtime via an adopted stylesheet (see runtimeAccents.js), so a user theme
behaves exactly like a built-in one.
- Description:
Theme context: applies the chosen base mode + accent to
<html>and keeps them live. Mirrors the i18n provider — the App owns the persisted values (settings.themeMode/settings.accent) and the user-theme list, and passes them in. Consumers (the ThemePicker) read the merged theme registry + actions viauseTheme().systemmode follows the OS (amatchMedialistener re-applies live). User themes are merged over the built-ins (override by id / add new) and applied at runtime via an adopted stylesheet (see runtimeAccents.js), so a user theme behaves exactly like a built-in one.
- Source:
Methods
(static) ThemeProvider(props)
Parameters:
| Name | Type | Attributes | Description | ||||||
|---|---|---|---|---|---|---|---|---|---|
props |
object |
Properties
|
|||||||
|
|||||||||
props.accent |
string | Persisted accent id (built-in or user theme). |
|||||||
|
|||||||||
props.userThemes |
Array.<object> |
<optional> |
Imported user themes. |
||||||
|
|||||||||
|
|||||||||
props.children |
React.ReactNode |
(static) useTheme()
- Description:
Read the current theme registry + setters. Must be used inside a ThemeProvider.
- Source: