Colours are powerful tools for anyone who creates dashboards! Our brain registers colours long before the form and content of texts. Tableau of course has quite a few colour schemes already available, but did you know that you can also add your own colour palette? In this blog I will explain how to do that.

Step 1: Determine your colour type

Before we dive into the technology, we must first determine what we need the colours for. Tableau has three different ways of using colours for data: 

  • Categorical (categorical) colours (type="regular"): 
    • For categorical values
    • Different colours to distinguish values, such as different product groups or regions
  • Sequential (sequential) colours (type="ordered-sequential"): 
    • For continuous values, such as financial values or percentages
    • One colour changing in intensity, e.g. light blue to dark blue
  • Different (diverging) colours (type="ordered-diverging"): 
    • For continuous values that have a natural mean or zero, such as positive and negative turnover, or percentage preference between two choices (Republicans vs. Democrats)
    • Two colours that change in intensity and blend into each other 

Of course, you can also use these colours without linking them to the data, for example as a background or to match. In my case, I want to use the corporate colours of The Information Lab for an internal dashboard. Because these are different colours, I need categorical colours for this.

Step 2: Decide on your colours

Once you have decided how you are going to use the colours, it is time to define them. There are various colour coding systems, but Tableau uses HEX codes. These are identified by a hash (#) followed by a combination of six (hex = six in Greek) letters and/or numbers. Most organisations have their corporate colours neatly defined and stored, so you can easily look them up or retrieve them.

1
The colour palette of The Information Lab on Coolors.co

If you would prefer to create your own palette, or use the colours that appear in any background image, there are fortunately very useful websites that can help you with this. The website Tableau Magic allows you to upload an image and choose a name for your palette, then it selects a specified number of colours and gives you the complete code you need later. Coolors.co It can also translate images into colours, but also allows you to choose your own colours, or look up lighter and darker shades of them. The HEX codes are then easy to copy.

Step 3: Add your colour palette

Once you have chosen your colours, it is time to place them in Tableau. This is done in the Preferences(.tps) file in the My Tableau Repository folder , which was created in your Documents folder when Tableau was installed. You can open this XML file with a text editor like TextEdit (Mac) or Notepad (Windows). When you do this for the first time, the file will look quite empty.

Tableau colour palette preferences

Then indicate that you want to add preferences, by inserting the following between the workbook tags <preferences> and </preferences> between the two preferences tags. Between the two preferences tags you can then add a palette, with <color-palette name='TIL logo' type = 'regular'>. Choose a name for this and see the different types at Step 1. Then add the HEX colour codes per new line between <color> and </color>. When you have added all the colours, close the palette with </color-palette>. Your file now looks something like this:

1

Save the file, and make sure you have closed any Tableau windows. Start Tableau and open a workbook of your choice, e.g. Superstore. Drag a categorical value (e.g. Category) to the colour block in your marks card. If you select edit colors , you can now select a palette from the list. Your own added palettes are at the bottom.

1

Please note!
In this example I used categorical colours, which are therefore all different. If you want to define sequential colours yourself, you must add several (at least two) shades of the same colour. Also, make sure that you use the correct type (in this case "ordered-sequential") in the preferences file. For different (diverging) colours, choose two different colours.

Done!

Congratulations, you have added your first own colour palette! A whole colour world now lies at your feet. A good colour scheme guides the eyes, shows connections and makes differences visible. But beware: your choices can also work against you. For example, did you know that about 8% of the men and 0.5% of the women in Northern Europe suffer from colour blindness? My colleague Daan Verkerk wrote an interesting blog about this. Do you want to know more about colour theory? Then read this blog by colleague Lars van Hoeve. And finally: on this helpdesk page of Tableau you can find much more information about the use of colours in Tableau.

Happy colouring!


All images are screen shots of the author