Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik and ServiceNow Partner to Bring Trusted Enterprise Context into AI-Powered Workflows. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
profilejamesbond
Creator II
Creator II

Change Theme with Button

Hi,

I want to change App theme and some times the apearance of the object using Button.

I mean, I publish an app theme a and there is a button or toggle button which said apply black theme.

Now, How to do it? Is there a way to toggle the themes in the Qlik SaaS App ?

 

Thanks

Labels (4)
1 Solution

Accepted Solutions
PythonMCSJ
Partner - Contributor III
Partner - Contributor III

Hi profilejamesbond,
 
Applying a theme to an app in Qlik Cloud will require communication with the Qlik Engine API's. So, if your requirement is limited to changing the theme in the app, you will either:
1. Have to create (or find an existing) extension, that handles this specific use case for theme selection through a button click.
or
2. Bind the button click to an automation, that calls an API endpoint of a service that communicates with the Qlik Engine API. You can find the documentation for the Qlik Engine API here: Qlik Engine JSON API | Qlik Sense for developers Help
 
Alternatively, if possible, you can structure the app in a way where colors, fonts etc are based on variables, and layout containers with show/hide conditions are used if needed. Then, you would instead bind the button to an action, that sets a particular value of a controlling variable (i.e. a variable that holds the value of the currently selected theme). All colors, fonts and etc used are then defined as variables, based upon the value of the controlling value. An example of this could be:

Controlling variable for theme:
Name: vThemeSelected
Default value = 'Theme 1'
 
Sheet background color variable:
Name: vSheetBackgroundColor
Value: If(vThemeSelected='Theme 1', '#ffffff', If vThemeSelected = 'Theme 2', '#000000', etc...
... and so on for all variables.

An alternative to the latter solution, is defining the theme and color bindings in the data model, so when a theme is selected, the Qlik data model binding handles the selections instead of the many if-statements and variables.

View solution in original post

1 Reply
PythonMCSJ
Partner - Contributor III
Partner - Contributor III

Hi profilejamesbond,
 
Applying a theme to an app in Qlik Cloud will require communication with the Qlik Engine API's. So, if your requirement is limited to changing the theme in the app, you will either:
1. Have to create (or find an existing) extension, that handles this specific use case for theme selection through a button click.
or
2. Bind the button click to an automation, that calls an API endpoint of a service that communicates with the Qlik Engine API. You can find the documentation for the Qlik Engine API here: Qlik Engine JSON API | Qlik Sense for developers Help
 
Alternatively, if possible, you can structure the app in a way where colors, fonts etc are based on variables, and layout containers with show/hide conditions are used if needed. Then, you would instead bind the button to an action, that sets a particular value of a controlling variable (i.e. a variable that holds the value of the currently selected theme). All colors, fonts and etc used are then defined as variables, based upon the value of the controlling value. An example of this could be:

Controlling variable for theme:
Name: vThemeSelected
Default value = 'Theme 1'
 
Sheet background color variable:
Name: vSheetBackgroundColor
Value: If(vThemeSelected='Theme 1', '#ffffff', If vThemeSelected = 'Theme 2', '#000000', etc...
... and so on for all variables.

An alternative to the latter solution, is defining the theme and color bindings in the data model, so when a theme is selected, the Qlik data model binding handles the selections instead of the many if-statements and variables.