Define Themes for Your Analytic Applications
Themes provide you with an efficient and reusable way to define the styles of your analytic applications. You can create a customized theme, use and modify it, and leverage related API to allow application users to change theme at runtime.
A theme is a one-stop solution to your enterprise's branding. It provides a consistent look and feel that complies to the corporate standard, while differentiating itself from hundreds of other applications. You can define a theme to store your favorite styles for canvas, popups and different types of widgets or choose an existing one to instantly change the application's look and feel.
When you find that the widget, canvas or popup in your analytic application doesn’t have the corresponding styling after applying the
theme, it may be that the styling defined in the styling panel overwrites the overlapping settings defined in theme preferences.
Therefore, go to the Styling panel, select
(Restore to Theme Preferences) so that the theme can be
fully applied to the application.
Create a Theme
Follow the steps below to create a new theme in design time.
Prerequisites
To create a theme, ensure that you have the object permission. For example, the creator and admin roles have access to themes.
Procedure
- Under Display in the toolbar, select Create Theme….
- In the Theme Preferences dialog, you can change the background color of canvas or popups and styling of widgets as you like.
- Select Save as to save your theme to the Files repository.
- In the Save As New Theme dialog, choose a folder to store your theme, and enter a name and optionally a description.
- Select OK.
Results
Use, Modify and Delete a Theme
You can directly use an existing theme to define your analytic applications or modify and override the existing theme preferences according to your needs.
Prerequisites
To use a theme, ensure that you have the object permission. For example, the creator and admin roles have access to themes.
If the theme is created by another user, make sure you have access to the theme in the Files repository.
Procedure
Results
-
In edit mode, you can decide whether to apply the updated theme, or keep the previous theme by saving as a new theme.
-
In view mode, the application will display the latest theme settings.
-
In edit mode, you can decide whether to apply the updated theme, or keep the previous theme by saving as a new theme.
-
In view mode, the application will display the Light Theme (Default) setting.
Use Theme API
You can leverage the theme-related API to allow application users to flexibly change the theme of the application at runtime.
Application.setTheme()
To specify the theme in the script, press Ctrl + Space to open the theme selector. After you choose a theme, the corresponding theme ID will be displayed in the syntax. If you choose not to define a theme in the syntax, the default light theme will be applied.
Currently, calling the setTheme() API from a popup doesn't affect the theme settings in it. To solve this, you can add a panel to the popup and include all the widgets in it.
Here's an example that shows how to leverage the API to allow application users to switch between different themes for your application.
First add a dropdown widget Theme_Dropdown to the canvas. In its Builder panel, fill ID column with the theme IDs and the Text column with the corresponding theme names.
var themeId = Theme_Dropdown.getSelectedKey(); Application.setTheme(themeId);
Now, users can select from the dropdown list to change to a different theme for the application.
Besides, application users can apply a specific theme at runtime by directly adding the theme ID to the application's URL like this:
https://master-app-building /sap/fpa/ui/bo/application/4FA12EC04829FDC682399273A7A3A0C?mode=embed;themeId=D991AAEEC518947626D749EDFF57D64C

Theme

(
(