You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: org.mixedrealitytoolkit.theming/README.md
+14-12Lines changed: 14 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
# MRTK Theming 3.0
1
+
# MRTK UX Theming
2
2
3
3
## Overview
4
4
@@ -10,22 +10,22 @@ The system has three layers:
10
10
|---|---|---|
11
11
|**Schema**|`ThemeDataSource` + `ThemeDefinition`| Declares what named items exist and what type each one is |
12
12
|**Values**|`Theme` (ScriptableObject) | Provides a concrete value for every item in the definition |
13
-
|**Binding**|`DataBinding` (MonoBehaviour) + binders | Connects a theme item to a specific component on a GameObject |
13
+
|**Binding**|`ThemeBinding` (MonoBehaviour) + binders | Connects a theme item to a specific component on a GameObject |
14
14
15
15
---
16
16
17
17
## Theme data source
18
18
19
19
A `ThemeDataSource` ScriptableObject is the single source of truth for which theme is currently active. Create one per logical theme domain (e.g. one for the whole app, or one per scene).
-**`activeTheme`** — the currently applied `Theme` asset.
26
26
-**`themeDefinition`** — the schema that all compatible themes must conform to.
27
27
28
-
To switch themes at runtime, assign a new `Theme` to `themeDataSource.value`. Every `DataBinding` component subscribed to that source will immediately receive and apply the new values.
28
+
To switch themes at runtime, assign a new `Theme` to `themeDataSource.value`. Every `ThemeBinding` component subscribed to that source will immediately receive and apply the new values.
29
29
30
30
### Theme definition
31
31
@@ -36,32 +36,34 @@ Each item has:
36
36
-**Name** — a string key used to match binders to values at runtime (e.g. `"Primary Color"`, `"Backplate Material"`).
37
37
-**Data type** — a concrete subclass of `BaseThemeItemData<T>` (e.g. `ColorThemeItemData`, `MaterialThemeItemData`).
A `Theme` ScriptableObject is assigned to a `ThemeDataSource` and provides a concrete value for every item declared in that source's `ThemeDefinition`.
The `Theme` inspector automatically displays one field per definition item, typed correctly. Themes are **complete** — every item in the definition must have a value. This ensures that switching themes always fully overwrites every bound property, with no leftover values from a previous theme.
48
50
49
51
---
50
52
51
-
## Data binding
53
+
## Theme binding
52
54
53
-
The `DataBinding` MonoBehaviour connects a `ThemeDataSource` to one or more components on the same GameObject (or its children). Add it to any GameObject that should respond to theme changes.
55
+
The `ThemeBinding` MonoBehaviour connects a `ThemeDataSource` to one or more components on the same GameObject (or its children). Add it to any GameObject that should respond to theme changes.
@@ -122,15 +124,15 @@ public class MyCustomBinder : BaseThemeBinder<Color, MyComponent>
122
124
}
123
125
```
124
126
125
-
The new binder will automatically appear in the `DataBinding` binder type dropdown in the Inspector, and the **Bound Theme Item** dropdown will show only the definition items whose data type is compatible with `T`.
127
+
The new binder will automatically appear in the `ThemeBinding` binder type dropdown in the Inspector, and the **Bound Theme Item** dropdown will show only the definition items whose data type is compatible with `T`.
126
128
127
129
---
128
130
129
131
## How theme switching works at runtime
130
132
131
133
1.`themeDataSource.value = newTheme` is called.
132
134
2.`ThemeDataSource` fires a `ChangeEvent<Theme>` to all listeners.
133
-
3. Each `DataBinding` component's binders receive the event via `OnThemeChanged`.
135
+
3. Each `ThemeBinding` component's binders receive the event via `OnThemeChanged`.
134
136
4. Each binder calls `Theme.TryGetItemData(ThemeDefinitionItemName, ...)` to look up its value.
135
137
5. If found, `Apply` is called with the new value. If not found, a warning is logged.
0 commit comments