QTheme

Note: STABLE.
This API is reliable and breaking changes are unlikely.

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.

Note: Calculated 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

Introduced Qlik Sense February 2018

Returned properties

Name Type Description
id String

Theme ID

properties 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

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 information help you?

Thanks for letting us know. Is there anything you'd like to tell us about this topic?

Can you tell us why it did not help you and how we can improve it?