Switch the palette of every view.
The palette to use.
Resolves once the player has accepted the change; Appearance.theme has the new value.
The player applies it to every open view without interrupting a drag or an open menu, and saves it across restarts.
invalid (rejects) theme is not a ThemeId.
Save the interface language for the next start.
"system" or a Locale.
Resolves once the player saved it; Appearance.language has the new value.
The player keeps the choice in its interface state; the language
changes when the player starts again (tell the user, for example "Takes
effect after restart"). Every plugin that listens to
appearance.changed sees the change in Appearance.language.
invalid (rejects) language is not "system" or a Locale.
The player will start in German next time, and the user is told so.
setLanguage only saves the choice: the language of this run
(i18n.locale) never changes while the player runs. Players before
0.4.3 reject it with unsupported.
await plugin.appearance.setLanguage("de");
await plugin.osd.show("Takes effect after restart"); // translated by the player
ReadonlythemeThe palette in use. Read before activation; while the plugin listens
to appearance.changed it follows other plugins' changes, otherwise
only this plugin's own.
ReadonlylanguageThe saved interface language: "system" (follow the system's
languages, the default) or a Locale.
This is the choice for the next start. The language of this run is
I18n.locale and never changes while the player runs. Read before
activation; while the plugin listens to appearance.changed it
follows other plugins' changes, otherwise only this plugin's own. Players before 0.4.3 report "system".
The player's palette, which every view uses.
plugin.appearance.Remarks
The player sets the palette on every view (the main window and its panels, the floating sidebar, tool windows, the Options window) before it appears and again when the palette changes. Slint code that reads its colours from
Theme(import { Theme } from "@vestra/theme.slint") follows it with no plugin code; hard-coded colours do not. Only colours change: corner radii, font sizes and control sizes are the same in every palette. A light palette also switches the std-widgets controls (std-widgets.slint) to their light colours, and keeps the video area dark.The player saves the choice; it stays after the plugin that set it stops. Tell the user about a change yourself (for example with Osd.show).
To run code when the palette or the language changes, listen with
plugin.player.on("appearance.changed", …):themeandlanguagealready hold the event's values when the listener runs.Example: Offer the light palette as a menu item
Settings ▸ Light colours switches every view of the player to the light palette and carries a radio mark while it is in use.
setasks the player to switch (it saves the choice);themeholds the palette in use, andcheckedreads it again after every handler.See
Theme
Since
1.0.0