Custom Color Palettes in Tableau


Recently I began a new job and I find that one of the first things I do when working with a new version of Tableau (be it at a new company or simply a new beta version) is set up the Preferences.tps file. After finding branding documents, I threw the RGB numbers into a converter to give me the HEX colors. http://www.rgbtohex.net/ is the site I used. These HEX color codes are then used to create my initial color palette.

For Windows users, your Prefereces.tps file is located in your C:\Users\<username>\Documents\My Tableau Repository folder. Right click on this file and open using Notepad. The file initially contains only a few lines of code. That’s all about to change…


Between the workbook tags, you will want to type <preferences></preferences>. Within these preferences tags we will create our initial color palette. I used returns and tabs to make the code easier to read.


To create a regular color palette, type <color-palette name="Name1" type="regular"></color-palette>. You can change the palette name to be something relevant to you. Within these tags we will need to define each color of the color palette. Each color is defined within the following tag:<color>#000000</color> where #000000 is the HEX color. You can define as many colors as you want in your palette. I defined ten colors. I also added comments (seen after the closing color tag) to more easily identify each color.


The order in which you define your colors will be the order in which they appear in Tableau. Each color in your regular color palette should be fairly different from the other colors. Use these colors to represent distinct values, such as Subregion, as shown in the example below.


Next we can create a few sequential color palettes. These are used in a gradient. To create a sequential color palette, type <color-palette name="Name1" type="ordered-sequential"></color-palette>. You can change the palette name to be something relevant to you. Within these tags we will need to define each color of the color palette. Each color is defined using the <color>#000000</color> tag.

I like to define ten colors in these palettes and I begin by determining what I want my main or darkest color to be. In this case, Green is the main color, so I’m going to use that as my starting point. I found this website to be extremely helpful in generating the HEX colors for each step in my gradient: http://www.perbang.dk/rgbgradient/. I put in my starting green HEX code and I think going to Light Gray would look nice. I want 10 steps and then click the Make gradient button.


You can see the RGB Gradient colors going from green to gray and the corresponding HEX codes. Type these codes between color tags and your file should look something like this:


I created two more sequential color palettes: Blue to Light Gray and Burgundy to Tan. These palettes are great when visualizing a single measure across different dimension values.


The last color palette you can create is a diverging color palette, which are the palettes that have two colors on each end and usually white or gray in the middle. To create a diverging color palette, type <color-palette name="Name1" type="ordered-diverging"></color-palette>. You can change the palette name to be something relevant to you. Within these tags we will need to define each color of the color palette. Each color is defined using the <color>#000000</color> tag. For diverging color palettes, I just define three colors. The beginning, middle, and end. I like to give myself a few options, so I’m going to put together 3 different diverging color palettes, which you can see in the image below.



Here are a few of the color palettes in action. Having these color palettes installed in the preferences file of Tableau, makes formatting dashboards and views much easier, but my favorite thing is that each dashboard and viz I create is going to immediately look more polished and branded for the company.




Do you want or need help creating a custom color palette to be used in Tableau? Comment below or contact me.

I know there are other things you can specify within this preferences file, but it’s not well documented. Do you know of anything?

Tableau’s knowledge base has the same information, but it doesn’t really help you actually create company colors: http://kb.tableausoftware.com/articles/knowledgebase/creating-custom-color-palettes

No comments:

Post a Comment