Patch a Theme

This applies to: Visual Data Discovery

When you patch a theme, you replace small sections of an existing theme.

At this time, you can only tailor theme colors. Other tailoring properties (such as fonts or font sizes) should not be changed.

To patch a theme:

  1. Identify the section of the JSON file that you want to patch. You can download a copy of it to work with if needed. See Review and Download the Theme JSON Code. The section that you select to patch does not need to include an entire section of the file, but it must be clear what you are changing and it must be well-formed. For example, suppose the following color variables are used in your JSON file but you only want to patch the setting for the background color variable.

    {
    "content":{
      "variables":{
    "colors":{
    "text":"#4a4a4a",
    "muted":"#999999",
    "border":"#cccccc",
    "background":"#f7f7f7",
    "onBackground":"#182026",
    "backgroundVariant":"#dedede",
    "onBackgroundVariant":"#4a4a4a",
    "surface":"#fff",
    "onSurface":"#182026",
    "primary":"#182026",
    "onPrimary":"#fff",
    "primaryVariant":"#30404d",
    "secondary":"#94b845",
    "accentColor":"rgba(19, 124, 189, 0.5)",
    "intentBase":"#f7f7f7",
    "intentBaseHover":"#f0f0f0",
    "intentBaseActive":"#dedede",
    "intentPrimary":"#137cbd",
    "intentPrimaryHover":"#106ba3",
    "intentPrimaryActive":"#0e5a8a",
    "intentPrimaryDisabled":"rgba(19, 124, 189, 0.5)",
    "intentSuccess":"#94b845",
    "intentWarning":"#d9822b",
    "intentDanger":"#db3737",
    "intentMinimal":"#5c7080",
    "intentMinimalHover":"rgba(167, 182, 194, 0.3)",
    "intentMinimalActive":"rgba(115, 134, 148, 0.3)",
    "intentMinimalDisabled":"rgba(167, 182, 194, 0.6)"
    },
    ...
    ... }, "createdByUserID": "string", "createdDate": "2020-04-28 19:40:22.369", "id": "string", "lastModifiedByUserID": "string", "lastModifiedDate": "2020-04-28 19:40:22.543", "name": "mytheme" }

    To patch the setting for the background variable, you would use this snippet of code when you submit the API request later in these steps.

    {
    "content":{
      "variables":{
    "colors":{
    "background":"#f00"
    } } },
    "createdByUserID": "string", "createdDate": "2020-04-28 19:40:22.369", "id": "string", "lastModifiedByUserID": "string", "lastModifiedDate": "2020-04-28 19:40:22.543", "name": "mytheme"
    }
  2. Note the ID for your theme. This must be specified separately from the rest of the JSON file in a patch request.

  3. Use the /api/customization/themes/<id> API endpoint in a PATCH request to update the theme. Use snippet of JSON code as the body ("content" : "<string>") of the request, but specify the ID of the theme as a parameter for the endpoint PATCH request.

    The following request patches the theme called mytheme.

    curl -X PATCH "http://<ip-address>:<port>/composer/api/customization/themes/<id>" -H "Content-Type: application/json" -d "{ \"content\": {\"variables\": { \"colors\": { \"background\": \"#f00\"}}, \"createdByUserID\": \"string\", \"createdDate\": \"2020-04-29T12:21:07.189Z\", \"id\": \"string\", \"lastModifiedByUserID\": \"string\", \"lastModifiedDate\": \"2020-04-29T12:21:07.189Z\", \"name\": \"mytheme\"

    where <ip-address> is the IP address or host name of your Symphony instance, <port> is its port, and <id> is the theme ID.

    If the theme is the active theme, refresh the Symphony UI to see the theme changes. If the theme is not the active theme, activate it to see the theme changes in the UI.