Skip to main content Skip to complementary content

QTheme

Information noteSTABLE.

This API is reliable and breaking changes are unlikely.

Class

QTheme()

An object that encapsulates a theme. The object is identical to the original theme.json file but with calculated styling values and helper methods for the theme.

Information noteCalculated values are different than the values in the original JSON file of the theme.

Functions, variables and fallback logic are computed to return a final value that can be used for styling. For example, the original value for "color" can be a variable like "@B80", whereas the calculated value then might be "#CCCCCC".

Version history

Version history
Version state Details
Introduced Qlik Sense February 2018

Returned properties

id

Type: String

Theme ID.

properties

Type: Object

Theme properties tree structure with calculated styling values.

Functions, variables and inheritance have been computed from the original theme JSON file.

Custom theme JSON properties

Example of returned properties

QTheme {
  id: "my-theme",
  properties: {
    "color": "#000",
    "fontSize": "12px",
    "backgroundColor": "#999",
    "object" : {
      "title": {
        "main": {
          "fontSize" : "13px"
        }
      },
      "pieChart": {
        "title": {
          "main": {
            "fontSize" : "16px"
          }
        }
      }
    }
  }
}

Example

app.theme.get('my-theme-id').then(function(qtheme){
  alert('Theme background color: ' + qtheme.properties.backgroundColor);
});

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!