public sealed class ThemeServiceSwitches between light and dark, and applies the user's own token overrides.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
Theming is nine custom properties on the root, and this class writes one class name. That is the whole of it, and it is what doc 11 means by "driven entirely by design tokens": there is no theme object, no palette type and no per-control colour, so a theme is a set of values and switching one is a restyle rather than a rebuild.
A user-editable theme file is a natural consequence rather than a feature — also doc 11's words. LoadTokens takes a YAML mapping of token to value and turns it into an author stylesheet, which beats the three user-agent sheets at equal specificity by origin alone. So a user overriding --accent needs no !important and no knowledge of what the control set's selectors look like.
⚠ One sheet, replaced rather than re-added. A theme file edited and reloaded ten times would otherwise leave ten sheets in the document, each overriding the last — which works, costs a cascade pass per reload, and makes removing an override impossible.
Fields and properties (3)
public const string DarkClassThe class the dark theme is selected by, which is the control set's own.
public ThemeMode ModeWhich theme is showing.
public string? TokensThe user's token overrides as they were last loaded, or null.
Events (1)
public Action<ThemeService>? ChangedRaised after the theme changes.
Methods (4)
public ThemeService(UiDocument document, ThemeMode mode = Dark)Takes charge of a document's theme.
public void Toggle()Switches to the other theme.
public void LoadTokens(string? yaml)Applies a user theme file.
public static string Compile(string yaml)Turns a theme file into the stylesheet it means.
Used by (4)
- EditorApplicationVixen.Editor.App
- EditorShellVixen.Editor.Ui
- EditorShellTestsVixen.Editor.Ui.Tests
- ServiceTestsVixen.Editor.Ui.Tests