Skip to end of metadata
Go to start of metadata

Requirements

The examples in this page use the Prototype library, which is included by default inside a portal. However, the same concepts may be applied using other implementations.

Description

These set of actions can retrieve a Theme information from the Studio. This includes getting a list of available themes, getting the active theme, and setting the active theme.

Invocation

This command is executed immediately in a synchronous way.

Get all available themes

The following dispatch call will get a names array of all the available Themes names:

The returned value is an array of strings (names).

Get the active theme name

The following dispatch call will get the active theme name string:

Set an active theme

The following code will set an active theme by passing a valid theme name.

The result value can be 'OK' or 'ERROR', which indicates if the operation was successful.

Sample of use

This code lists all available themes in a dropdown list, select the active theme in the list, and allow switching a theme with a click of a button.

From studio3-sdk repository (themes.js)