Custom Colour Palettes in Tableau

by Robbin Vernooij

A quick guide to creating custom colour palettes in Tableau.

Tableau offers a range of regular and diverging colour palettes, but there are times when you would like to use a different range of colours or for instance your company colour scheme. Many thanks to George for sharing!

 

1. Adding colours to your preferences

Ever wondered what the Preferences.tps file inside your Tableau repository is for? As the name implies, it’s created to store all your predefined preferences and it can be used to store your custom colour palettes.

The file can be found in your ”\My Tableau Repository” folder usually located in your documents folder (For instance the default path for windows is: C:\Users\User_Name\Documents\My Tableau Repository).

Open up the file with a text editor (like Brackets or Notepad++). If you have never edited it before it should read something along the lines of this:

Next add some lines and insert <preferences> below <workbook> and </preferences> above </workbook>.

Now, in between preferences you can add your colour schemes and I have provided an example scheme below, outlining what each field means.

preferences_4

Make sure to start every new colour palette with <color-palette name=”Name” type=”type”> followed by all the hex colour codes and end with </color-palette>.

If you are familiar with hex colour codes, this is all you need to know. Make sure you restart Tableau after editing your Preferences.tps

However, like myself, I didn’t know all the hex colour codes by heart…

2. Finding Hex Colour Codes

Hex colour codes are used to define a specific colour with a combination of letters, starting with a #.

Google has most the answers you need in order to find particular hex colour codes or combination colours that work well together (try searching diverging hex colour codes or R studio colour palettes hex codes).

However, I do recommend using websites like coolors.co, which allow you to either generate codes from colours defined on their site, or by picking them directly from images! (uploaded or an URL)

Now, if you’re as proud of your country as myself. You know your national hex colour codes by heart:

#AE1C28 = Red
#FFFFFF= White
#21468B = Blue
#FF4F00 = Orange

To give you an example, I have added all those colours to the preferences as regular colour type as well as a diverging (red-white-blue). As mentioned above, once you finished editing your preferences, you have to restart Tableau for them to show up.

Depending on the field placed on your colour palette in Tableau, either the discreet “Dutch” or continuous “Dutch Diverging” will now show up in the list.

You can now start applying your own colour palettes to apply colours of your choosing, but keep in mind, that minimal use of colour, such as black & white, grey scale or in combination with one colour that stands out, can be very effective in most cases!