@vestra-player/sdk - v1.11.3
    Preparing search index...

    Interface Appearance

    The player's palette, which every view uses. plugin.appearance.

    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", …): theme and language already hold the event's values when the listener runs.

    Settings ▸ Light colours switches every view of the player to the light palette and carries a radio mark while it is in use. set asks the player to switch (it saves the choice); theme holds the palette in use, and checked reads it again after every handler.

    plugin.commands.add({
    id: "light-colours",
    path: ["@settings", "Light colours"],
    radio: true, // a round mark instead of a check mark
    checked: () => plugin.appearance.theme === "vestra-light",
    run: () => plugin.appearance.set("vestra-light"),
    });

    Theme

    1.0.0

    interface Appearance {
        theme: ThemeId;
        set(theme: ThemeId): Promise<void>;
        language: LanguagePreference;
        setLanguage(language: LanguagePreference): Promise<void>;
    }
    Index
    • Switch the palette of every view.

      Parameters

      • theme: ThemeId

        The palette to use.

      Returns Promise<void>

      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.

      Every view of the player turns light, and stays light after a restart. The player applies the palette to every open view and saves the choice; when the promise resolves, appearance.theme already has the new value.

      await plugin.appearance.set("vestra-light");
      

      1.0.0

    • Save the interface language for the next start.

      Parameters

      Returns Promise<void>

      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.

      0.4.3

      invalid (rejects) language is not "system" or a Locale.

      unsupported (rejects) A player before 0.4.3.

      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

      1.5.9

    theme: ThemeId

    The palette in use. Read before activation; while the plugin listens to appearance.changed it follows other plugins' changes, otherwise only this plugin's own.

    The 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".

    1.5.9