KNOWLEDGE BASE

Show color based on RGB values in data source


Published: 31 Jan 2023
Last Modified Date: 17 Mar 2023

Question

How to show color based on RGB values in data source.

Environment

  • Tableau Desktop

Answer

Workaround

Prerequisite: All types of RGB color codes you want to use must be listed in advance.
 
1. Prepare a custom sequential color palette including all types of RGB color codes you want to use.
See "Create a custom sequential color palette" section in Create custom color palettes for directions.
For example:
color palette
*For reference, please see the attached "example color palette".
*You can write RGB color codes in RGB format or hexadecimal format. See How to Set Custom Color Palette Code (in Hexadecimal Value or Rgb Format)
2. Create a color table corresponding to the order of the RGB color codes in the palette.
Create a color table on a data source that can create a relationship with the data source you use (eg CSV or Excel file).
Example:
No    RGB
1    #9fcd99
2    #ffdd71
3    #f26c64
4    #69b764
5    #ffc156
6    #d82526
7    #309343
8    #dba13a
9    #b10318
*For reference, please see the "color_table" sheet in the attached "example color table.xlsx".
3. Create a workbook and a relationship with the color table.
make relationship
4. Create a viz and set color with No in the color table.
 1) Put [No] field on color.
 2) On the Marks card, Color -> Edit Colors. Change the palette to the custom color palette you prepared.
User-added image
 

Additional Information

A sequential color palette loads colors in the order that they appear in the custom palette file. That's why by describing the order of RGB codes in the color table, colors can be set corresponding to the RGB strings in the record.
Did this article resolve the issue?