Windows
Configuration
Use the themes property of the configuration object for initializing the @interopio/browser-platform library in the Main app to specify custom settings for the Themes library:
import IOBrowserPlatform from "@interopio/browser-platform";
const config = {
licenseKey: "my-license-key",
themes: {
defaultTheme: "os"
}
};
const { io } = await IOBrowserPlatform(config);Configuring the Themes library is optional. The configuration object for the themes property has the following properties:
| Property | Type | Description |
|---|---|---|
defaultTheme |
"os" | "light" | "dark" |
Specifies the default theme for io.Connect Browser. Set to "os" to use the default theme as set in the OS. |
Listing All Themes
To get a list of all available themes, use the list() method:
const allThemes = await io.themes.list();Current Theme
To get the currently selected theme, use the getCurrent() method:
const currentTheme = await io.themes.getCurrent();Selecting Themes
To select a theme, use the select() method:
const themeName = "dark";
await io.themes.select(themeName);Theme Events
To get notified when the theme changes, use the onChanged() method:
const handler = newTheme => console.log(newTheme.name);
io.themes.onChanged(handler);API Reference
For a complete list of the available Themes API methods and properties, see the Themes API Reference Documentation.