How to Create Custom Color Palette in Tableau – Part 1

Tableau provides awesome visualizations and color palettes. I will show you how to create custom color palette in Tableau. 

Tableau provides multiple color palettes, but in case you have to create your own custom color palette, use preferences.tps file.

Why use Preferences.tps file ?

Prefrences.tps file can be used to create consistent colors across the enterprise. It is also useful when developer has to use colors which are discontinued by Tableau in the new versions of Tableau desktop.

Types of Color palettes in Tableau

There are 2 types of Color palettes in Tableau:

Regular: Used for Dimensions or Discrete Fields

Sequential: Used for Measures or Continuous Fields

How to use colors in Tableau

Step 1:  Launch Tableau Desktop and Connect to ‘Sample Superstore Data.xls’.  Learn how to connect to excel data source

Step 2: Select the Orders table to create a Bar Chart  – use Sub-Category from Dimension and Sales from Measure.

Step 3: Create a bar chart using the above fields and place the Sub-Category Field to the Colors Shelf.

In the above sheet, you can observe Tableau by default allocates some Color palette to the Chart.

Step 4: We can change the color palette of chart, by clicking on Colors Shelf and Select the Edit Colors option.

 

In the Select Color Palette option, we can see multiple Color palettes provided by Tableau .We can select any one from the list and assign to the chart.

If you don’t want to go with the Tableau provided Color Palettes and would like to create your own custom palette, use Prefrences.tps file.

Steps to create Regular Custom Color Palette in Tableau

Step 5: Close Tableau Desktop.

Step 6: Navigate to ‘My Tableau Repository’ Folder under \\Documents\My Tableau Repository, and open Preferences.tps extension in Notepad

Note: This contains XML script. It can only be open in a text editor, such as Notepad.

Step 7: Use the following XML script to create Custom Color palette using HTML codes of 17 Colors.

<?xml version=’1.0′?>

<workbook><preferences>

<color-palette name=”Custom Color Palette” type=”regular” >

<color>#eb912b</color>

<color>#7099a5</color>

<color>#c71f34</color>

<color>#314d6a</color>

<color>#82a6bd</color>

<color>#ff5500</color>

<color>#bf8e5d</color>

<color>#197131</color>

<color>#6da964</color>

<color>#8a7322</color>

<color>#ffc156</color>

<color>#2c5e5a</color>

<color>#b50e1b</color>

<color>#bd5044</color>

<color>#744746</color>

<color>#383333</color>

<color>#c71f34</color>

</color-palette>

</preferences></workbook>

Step 8:

Copy the above Code into the prefernces.tps file. Save and close the file.

Note : This code will create Custom Color Palette. Notice type=”regular” this will create Regular custom color palette to be used with Dimensions or discrete data elements.

Step 9: To See the Custom Color palette in Tableau, Close the Tableau Application by saving the workbook and Restart the application.

Open the saved workbook to apply the Created Custom Palette for the chart. Follow the same steps of selecting the Colors shelf and opening the Edit Colors Option.

Select the ‘Custom Color Palette’ present at the bottom in the list of Select Color palette option and assign the palette.

It should show this below Colors for the Chart.

 

Please see step-by-step video below

 

 

 

In the next blog, i will cover how to create Sequential color palette in Tableau.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.