Introduction
You can create your own custom color palette in Tableau by modifying the Preferences.tps file that comes with Tableau Desktop. You can find this file on My Tableau Repository folder located in your documents folder.
The Preferences file is simply a basic XML file that you can open in a text editor to modify. Here is a sample of unedited preferences file.
To edit your preferences file, insert the opening and closing preferences tags between the opening and closing workbook tags as shown below.
(Add the rest of code between the opening and closing preferences tags - as shown in the section below)
Note: When you edit preferences file, be sure to use straight quotation marks (' ' or " ") to delimit the palette name and type, and not curly quotation marks (‘ ’ or “ ”).
Note: Tableau doesn’t support custom color palettes, and therefore there is NO guarantee that your custom color palettes will work with the future Tableau Desktop upgrades.
Create a custom categorical color palette.
A categorical color palette contains distinct colors that can be assigned to discrete dimensions members. A good example of a categorical color palette is in the snapshot below.
(When you drag a discrete dimension field Region to the color shelf – a categorical color palette is applied by default as shown above.)
So, how can you create a custom categorical color palette?
To create a custom categorical color palette, open the Preferences.tps file in a text editor and edit the file as follows.
(In the above example, I have added my code as highlighted between the opening and closing preferences tags. The code contains the name of color palette in this case ‘My Categorical Palette’, type as ‘regular’ which identifies this palette as categorical. And six hex color codes identifying the six colors forming the categorical color palette).
Note: You can use these tools to pick suitable hex color codes for your palette.
Next, save the preferences.tps file, and restart your Tableau Desktop.
Open Tableau Desktop, connect your data and add a discrete dimension to the color shelf.
From the edit colors dialogue box, you’ll find your custom categorical color palette at the bottom of the list.
Create a custom sequential color palette.
Sequential color palette shows a single color varying in intensity. This color palette is used for continuous fields (typically measures).
A good example of a sequential color palette is in the example below.
To create a custom sequential color palette, repeat the same process with the following code.
(In the above example, I have added my code between the opening and closing preferences tags. The code contains the name of color palette in this case ‘My Sequential Palette’, type as ‘ordered-sequential’ which identifies this palette as sequential. And five hex color codes identifying the five colors forming the sequential color palette).
Note: You can use these tools to pick suitable hex color codes for your palette.
Next, save the preferences.tps file, and restart your Tableau Desktop.
Open Tableau Desktop, connect your data and add a continuous measure field to the color shelf.
From the edit colors dialogue box, you’ll find your custom sequential color palette at the bottom of the list.
Create a custom diverging color palette.
Diverging color palette shows two ranges of values using color intensity to show the magnitude of the number and the actual color to show which range the number is from. Diverging color palettes are most used to show the difference between positive and negative numbers.
To create a custom diverging color palette, repeat the same process with the following code.
(In the above example, I have added my code between the opening and closing preferences tags. The code contains the name of color palette in this case ‘My Diverging Palette’, type as ‘ordered-diverging’ which identifies this palette as diverging. And ten hex color codes identifying the ten colors forming the diverging color palette).
Note: You can use these tools to pick suitable hex color codes for your palette.
Next, save the preferences.tps file, and restart your Tableau Desktop.
Open Tableau Desktop, connect your data and add a continuous measure field to the color shelf.
From the edit colors dialogue box, you’ll find your custom diverging color palette at the bottom of the list.
Conclusion
So, next time you need to access custom color palettes in your Tableau Desktop try the ideas shared in this article – inspire your dashboard design process with unique color schemes.
I hope this article was helpful to you. If you wish to receive more Tableau tips and tricks, kindly join our mailing list by subscribing below.
If you like the work we do and would like to work with us, drop us an email on our contacts page and we’ll reach out!
Thank you for reading!
Comments