An Exploration of Custom Color Palettes

This post is an exploration of why the two views above look different even though the red for 100% is the exact same for each, as in South Dakota for 2013 Q4:
Screen Shot 2016-02-07 at 7.18.31 PM

Screen Shot 2016-02-07 at 7.20.00 PM

I recently had the opportunity to dive into how Tableau assigns colors, as the goal for this particular worksheet is to make all the 0.0%’s have a white background so the rest of the colors have a little more breathing room. I came out of it impressed with the work that Tableau’s color designers (Maureen Stone and others) have done to create good looking color palettes in Tableau. Read on for some details on how to build your own palettes.

The view is set up using Superstore Sales with a % of Furniture measure that is counting the number of records for the Furniture Product Category as a % of all records for all categories so it returns anywhere from 0-100%, with some cells being completely empty due to no sales in those State/Quarter combinations, such as Wyoming in the above views.

When building a heatmap using the default Red sequential palette (see Default Red Sequential Palette sheet) there are lots of 0.0% cells that kind of clog up the view and make it harder to see the variation in the data:

Screen Shot 2016-02-07 at 7.23.44 PM

What I’d really like to do is to have the 0.0% cells start out as white (effectively transparent) and then have the color ramp go from there. We can’t do that with default Red sequential palette because that palette starts out with pinkish-grey color (#eac0bd in hex):

Screen Shot 2016-02-07 at 7.24.19 PM

Customizing the Red/White/Green Palette to White/Red

Tableau does provide some palettes with a white to red range, though, and we can use one of those. So the next idea is to use a diverging palette where we set the 0 point to be on the white. Here’s how to do that:

  1. Choose the Red/White/Green Palette
  2. Click on Reversed.
  3. Click on Advanced>>.
  4. Set the Center to 0.

Screen Shot 2016-02-07 at 7.24.56 PM

And here’s the view:

Screen Shot 2016-02-07 at 7.25.52 PM

This certainly gets a the 0.0% cells to be white, but doesn’t quite look as warm and saturated as the default red sequential palette, particularly at the lower end of % values such for Idaho.

Screen Shot 2016-02-07 at 7.32.05 PM

The reason why is based on how Tableau assigns color palettes and how those default color palettes are built. The rest of this post describes both of those, and finally how we can get a palette that has the 0.0% values as white while getting the warmth of the Red sequential palette.

How Tableau Assigns Colors

Here’s how Tableau assigns the colors for a sequential set of colors (where there is only one range from 0):

  • The bottom end of values in the data gets the bottom end of the color ramp
  • The top end of values in the data gets the top end of the color ramp
  • The colors for everything in-between are linearly distributed across the color ramp based on the values

What’s a color ramp? It’s the gradient of colors used for assigning the values – in short, what we see in the Color Legend. Here are the two color ramps for the default Red sequential and the customized red/white/green palette:

Screen Shot 2016-02-07 at 7.40.02 PM

We can shift the start and end values using the Advanced>> options for sequential palettes, so any value at or below the custom start value would get the bottom end of the color ramp and any value at or above the custom end value would get the top end of the color ramp. With a diverging palette we get a third Advanced>> option to move the center point. So what we effectively did in the above steps with the Red/White/Green palette is:

  1. Choose the Red/White/Green palette. The data range goes from 0-100% so 0% gets red, 50% gets white, and 100% gets green.
  2. Reverse the palette. Now 0% gets green, 50% gets white, and 100% gets red.
  3. Click on Advanced>> to get more options.
  4. Set the Center to 0. Now 0% gets white and 100% gets red, with 50% being a lighter red between the white and the red. Anything below 0 would get green, but there’s nothing in the data to show that.

Now that we have an understanding of that, let’s look at the colors themselves to understand how the colors aren’t as warm in this palette as they are in default Red sequential palette.

Simplest Case: White to Red

Let’s start out with the absolute simplest color ramp: a sequential palette with two colors. I edited the …/My Tableau Repository/Preferences.tps file using the instructions at In the Simplest White to Red Palette worksheet I’ve set up a two color palette, white to red. Here’s the XML for the palette:

<color-palette name="Simplest White to Red Sequential" type="ordered-sequential">
  <color>#FFFFFF</color> <!-- bottom white -->
  <color>#9c0824</color> <!-- top red --&gt

And the view:

Screen Shot 2016-02-07 at 7.42.20 PM

Now, one thing with this palette is that the top red is the exact same red used in Tableau’s default Red sequential palette, but by comparing the Simplest White to Red Palette to the Default Sequential Red Palette the two color ramps look completely different, and it’s not because we’re starting out with white…

Screen Shot 2016-02-07 at 7.43.43 PM

Tableau-ish Red Sequential

Even if we use the same start and end colors in the ramp as the default Red palette we won’t end up with the same color ramp. The Tableau-ish Red Sequential Palette worksheet uses the following palette which duplicates the bottom greyish-pink and darker red used by Tableau’s Red sequential palette:

<color-palette name="Tableau-ish Red Sequential" type="ordered-sequential">
  <color>#eac0bd</color> <!-- bottom grey-ish pink -->
  <color>#9c0824</color> <!-- top red -->

Here’s the color legend:

Screen Shot 2016-02-08 at 12.29.48 AM

We can see that the color ramp is much cooler than the one for the default Red sequential palette. These simple two-color palettes are not duplicating Tableau’s built-in palette and the reason why is that Tableau’s default Red sequential palette *doesn’t use only two colors*. If you’re a designer who stares at colors all the time you probably picked up on that long ago, it took me longer!

So the Tableau-ish palette starts at the bottom grayish-pink and transforms into the darker brick red. The simplest white/red palette above starts at the bottom with white and transforms into the darker brick red. But the default Red sequential palette starts at the bottom greyish-pink, then shifts to something more salmon, then saturates that more and more and subtly changes the hue until the ramp finishes with a darker brick red, thereby creating a much more complex gradient of color that changes both hue and lightness. I really don’t know how many distinct colors are in this color ramp, all I can say is that it’s more than 4. Tableau’s color designers have created a palette with multiple “stops” of color that is warmer (and more visually interesting!) than any simple single transformation of the color.

Based on some testing here’s how Tableau assigns the color ramp to the data, given N colors in the palette:

  • the bottom end of values in the data gets the bottom end of the color ramp
  • the top end of values in the data gets the top end of the color ramp
  • the color ramp is evenly divided into N-1 segments
  • the colors for values in a given segment are linearly distributed across the start and end colors for that particular segment
Now that you know this you can do great things, or terrible things. Please don’t do terrible things.

So to get something closer to the default palette we can add more colors between the white and the red.

Adding One Intermediate Stop: Simple White to Red Palette

For this view I created a color palette with one stop between white and red:

<color-palette name="Simple White to Red Sequential" type="ordered-sequential">
 <color>#FFFFFF</color> <!-- white -->
 <color>#d8392c</color> <!-- 50% red -->
 <color>#9c0824</color> <!-- top red -->

Here’s the view:

Screen Shot 2016-02-07 at 8.57.02 PM

That’s looking a little better…here’s the two color legends:

Screen Shot 2016-02-07 at 8.56.53 PM

It’s still a little cool between 0 and 50% where the colors are looking a little too washed out. The solution to this is add more colors.

Adding Two More Intermediate Stops: Richer White to Red Palette

Here’s a color palette that gets even closer to the original Red sequential palette:

<color-palette name="Richer White to Red Sequential" type="ordered-sequential">
 <color>#FFFFFF</color> <!-- white -->
 <color>#f57667</color> <!-- 25% red -->
 <color>#d8392c</color> <!-- 50% red -->
 <color>#c11218</color> <!-- 75% red -->
 <color>#9c0824</color> <!-- top red -->

And the view:

Screen Shot 2016-02-07 at 8.59.34 PM

Idaho at 10% is still looking lighter, but it’s very much closer. Personally I’m ok with this as meeting the goal of showing the white background for 0.0%  while preserving enough of the Tableau color ramp to make useful comparisons. So I can still easily tell in the view above that New Mexico had the highest performance while the change from 2013 Q1 to 2013 Q2 stands out a lot more than in the original.

Here are the color legends:

Screen Shot 2016-02-07 at 9.00.00 PM

The results here are now the same as the default red sequential palette from 25% to 100%, so only from 0-25% are they slightly cooler because of the white to red color ramp. To get an even warmer palette we’d have to add even more steps, and add them evenly to retain the color ramp, so for example we could add 4 more at 12.5/25/37.5/50/62.5/75/87.5/100%.


Here’s the heatmap color palette workbook on Tableau Public and the Preferences.tps file.

There were a couple of great presentations at TC15 on color, you can catch them in the Tableau Virtual Conference:

  • Using Color Effectively: Tips from a Color Science Researcher by Maureen Stone had some great insights on Tableau’s thinking.
  • 50 Shades of Data: A Zen Master’s Guide to Color by Matt Francis is a tour de force through the world of color. Be warned, though, you will never look at movie posters or advertising in the same way again!

5 thoughts on “An Exploration of Custom Color Palettes

  1. Siraj Samsudeen

    Hi Jonathan, thanks for posting such a detailed experiment on how the color palette works. Even I was noticing the fading-out effect when I use my own palettes and was wondering about it and your blog post came at the right time to help me understand it better.

  2. Pingback: Two Sequential Color Palettes on the Same Map: Coloring by a Dimension and a Measure | Drawing with Numbers

    1. Jonathan Drummey Post author

      Sorry for the delay, I’ve been away. If the data doesn’t have negative values then I’d use a calculated field for Color that sets the Null values to -1 or some other negative number and then a diverging palette with the Advanced options where negative is white, 0 is set to the starting color and then the rest of the color ramp is used.


Please add your thoughts and perspectives