Create Custom Colour Palettes

Tableau Desktop comes with colour palettes that have been carefully designed to work well together and effectively apply colour to data in many situations, such as on maps, heatmaps, bar charts, etc. You can also create and use your own custom colour palettes by modifying the Preferences.tps file that comes with Tableau Desktop. For example, you can create a custom categorical palette that matches your company's brand.

About the preferences file

You can add as many custom palettes as you like to your Preferences.tps file, each with as many colours as you want. Although there isn’t a limit to how many colours can be added to each custom palette, the Edit colours dialog box only shows 20 colours. If you need to manually assign more than 20 colours to data items, you may want to create several custom palettes with 20 or fewer colours in each palette.

When you modify Preferences.tps to add colours, use the standard HTML format for the new colours (hex code #RRGGBB or Red Green Blue format). When you save the workbook and restart Tableau Desktop, the colour palette names you added to Preferences.tps appear in the Select Colour Palette drop-down list (Edit Colour dialog). You can use a custom palette like you would any other.

Tableau doesn't test or support custom colour palettes, so be sure to back up your workbooks before you continue. Also, there is no guarantee that custom colour palettes you create will work with future Tableau Desktop upgrades.

Note: When you edit your Preferences.tps file, be sure to use straight quotation marks (' ' or " ") to delimit the palette name and type, not curly quotation marks (“ ” or ‘ ’).

Edit the preferences file

The Preferences.tps file is located in the My Tableau Repository folder that is created when you install Tableau Desktop, likely located in Documents. The preferences file is a basic XML file that you can open in a text editor to modify. An unedited preferences file looks like this:

To edit your preferences file:

  1. Go to the My Tableau Repository folder in your Documents directory, and open the Preferences.tps file with a text editor.
  2. Between the opening and closing workbook tags, insert opening and closing preferences tags so that it looks like this:
    <?xml version='1.0'?>
    <workbook>
    <preferences>
    </preferences>
    </workbook>

    Note: If your Preferences.tps file already has preferences tags, you don't need to add them again.

  1. Follow one of the next procedures to create a custom colour palette by inserting color-palette tags between the preferences tags. For example:
    <?xml version='1.0'?>	
    <workbook>
    <preferences>
    <color-palette name="MyColors" type="regular">
    <color>#1e4c56</color>
    <color>#cba94b</color>
    </color-palette>
    </preferences>
    </workbook>

    Colour palettes can be categorical (type="regular"), sequential (type="ordered-sequential") or diverging (type="ordered-diverging").

  2. To add more palettes, insert another set of color-palette tags.
    <?xml version='1.0'?>	
    <workbook>
    <preferences>
    <color-palette name="MyColors" type="regular">
    <color>#1e4c56</color>
    <color>#cba94b</color>
    </color-palette>
    <color-palette name="MoreColors" type="regular">
    <color>#ffe96f</color>
    <color>#799a0d</color>
    </color-palette>
    </preferences>
    </workbook>
  3. You must restart Tableau Desktop to see the new colour palettes.

Create a categorical palette

A categorical colour palette contains several distinct colours that can be assigned to discrete dimension members. For example, when you put a discrete dimension such as Region on the Colour card, the categorical colour legend is used.

In the preferences file, a categorical palette is type="regular".

Build a custom categorical colour palette

Create a sequential palette

Another type of palette is the sequential colour palette. This type of colour palette is used for continuous fields, typically for measures. Typically, a sequential palette shows a single colour, varying in intensity.

You must specify at least the two end colours in the sequential colour range. Tableau will extrapolate the shades in between.

Build a custom sequential colour palette

Create a diverging colour palette

The third type of colour palette is a diverging colour palette. Instead of a gradient from one extreme to the other, a diverging palette is like two sequential palettes that share a colour in the middle but have different extremes. This type of palette shows two ranges of values using colour intensity (how dark or light) to show the magnitude of the number, and the actual colour (orange or blue) to show which range the number is from. Diverging palettes are most commonly used to show the difference between positive and negative numbers.

Build a custom diverging colour palette

Use discontinued (classic) colour palettes

In version 10.0, Tableau created new colour palettes, updated some existing ones (such as Tableau 10 and Tableau 20), and discontinued others. If you want to keep using a colour palette that was discontinued, you can edit your Preferences.tps file to add the hex values for the palette. You can add as many colour palettes as you like.

Hex values for discontinued colour palettes