Use custom function

As commented you may create a function that if called with a custom colorname returns the hex color from the list.

import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns

# Wanted palette details
enmax_palette = ["#808282", "#C2CD23", "#918BC3"]
color_codes_wanted = ['grey', 'green', 'purple']

c = lambda x: enmax_palette[color_codes_wanted.index(x)]

x=np.random.randn(100)
g = sns.distplot(x, color=c("green"))

plt.show()

Use the C{n} notation.

It should be noted that all colors in seaborn are matplotlib colors. One option matplotlib provides is the so called C{n} notation (with n = 0..9). By specifying a string like "C1" you tell matplotlib to use the second color from the current color cycle. sns.set_palette sets the color cycle to your custom colors. So if you can remember their order in the cycle you can use this information and just specify "C1" for the second color.

import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns

# Wanted palette details
enmax_palette = ["#808282", "#C2CD23", "#918BC3"]

sns.set_palette(palette=enmax_palette)

x=np.random.randn(100)
g = sns.distplot(x, color="C1")

plt.show()

Manipulate the matplotlib color dictionary.

All named colors are stored in a dictionary you can access via

matplotlib.colors.get_named_colors_mapping()

You may update this dictionary with your custom names and colors. Note that this will overwrite existing colors with the same name.

import numpy as np
import matplotlib.pyplot as plt
from matplotlib import colors as mcolors
import seaborn as sns

# Wanted palette details
enmax_palette = ["#808282", "#C2CD23", "#918BC3"]
color_codes_wanted = ['grey', 'green', 'purple']
cdict = dict(zip(color_codes_wanted, [mcolors.to_rgba(c) for c in enmax_palette]))

mcolors.get_named_colors_mapping().update(cdict)
x=np.random.randn(100)
g = sns.distplot(x, color="green")

plt.show()

All codes shown here will produce the same plot in "the company's green" color:

Answer from ImportanceOfBeingErnest on Stack Overflow
🌐
Seaborn
seaborn.pydata.org › tutorial › color_palettes.html
Choosing color palettes — seaborn 0.13.2 documentation
The return value is an object that wraps a list of RGB tuples with a few useful methods, such as conversion to hex codes and a rich HTML representation. Calling color_palette() with no arguments will return the current default color palette that matplotlib (and most seaborn functions) will ...
🌐
Medium
medium.com › analytics-vidhya › deep-dive-into-seaborn-palettes-7b5fae5a258e
Deep Dive into Seaborn: Color Palettes | by Yoann Mocquin | Analytics Vidhya | Medium
November 24, 2022 - For example (0.1, 0.5, 0.9) would ... defined by 6 hex-characters #RRGGBB where RR (red), GG (green) and BB (blue) are hexadecimal integers between 00 and FF specifying the intensity of the color....
Discussions

python - Extract RGB or 6 digit code from Seaborn palette - Stack Overflow
Seaborn has an option to create nice color palettes. I wish to use these palettes to generate colors that work well together in a map where countries are shaded according to some property. The foll... More on stackoverflow.com
🌐 stackoverflow.com
Creating Custom Seaborn Color Palettes from ONLY two Hex Codes? [Question]
import seaborn as sns from matplotlib.colors import LinearSegmentedColormap from matplotlib.cm import register_cmap # relative positions of colors in cmap/palette pos = [0.0,1.0] colors=['#3877C7','#C75B38'] cmap = LinearSegmentedColormap.from_list("", list(zip(pos, colors))) register_cmap("my_cmap", cmap) palette= sns.color_palette("my_cmap",n_colors=50) sns.palplot(palette) plt.show() More on reddit.com
🌐 r/learnpython
2
1
July 5, 2020
All seaborn color palettes together, so you don't have to search for them everytime
Would have been nice if they are sorted in diverging colormaps, selective ones etc. More on reddit.com
🌐 r/visualization
13
119
October 20, 2021
Python data visualization library seaborn's polite way of asking have I've lost all good chromatic sense

Excell default color palette. Much better than it used to be, but still cringey.

More on reddit.com
🌐 r/visualization
8
25
May 17, 2016
Top answer
1 of 1
12

Use custom function

As commented you may create a function that if called with a custom colorname returns the hex color from the list.

import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns

# Wanted palette details
enmax_palette = ["#808282", "#C2CD23", "#918BC3"]
color_codes_wanted = ['grey', 'green', 'purple']

c = lambda x: enmax_palette[color_codes_wanted.index(x)]

x=np.random.randn(100)
g = sns.distplot(x, color=c("green"))

plt.show()

Use the C{n} notation.

It should be noted that all colors in seaborn are matplotlib colors. One option matplotlib provides is the so called C{n} notation (with n = 0..9). By specifying a string like "C1" you tell matplotlib to use the second color from the current color cycle. sns.set_palette sets the color cycle to your custom colors. So if you can remember their order in the cycle you can use this information and just specify "C1" for the second color.

import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns

# Wanted palette details
enmax_palette = ["#808282", "#C2CD23", "#918BC3"]

sns.set_palette(palette=enmax_palette)

x=np.random.randn(100)
g = sns.distplot(x, color="C1")

plt.show()

Manipulate the matplotlib color dictionary.

All named colors are stored in a dictionary you can access via

matplotlib.colors.get_named_colors_mapping()

You may update this dictionary with your custom names and colors. Note that this will overwrite existing colors with the same name.

import numpy as np
import matplotlib.pyplot as plt
from matplotlib import colors as mcolors
import seaborn as sns

# Wanted palette details
enmax_palette = ["#808282", "#C2CD23", "#918BC3"]
color_codes_wanted = ['grey', 'green', 'purple']
cdict = dict(zip(color_codes_wanted, [mcolors.to_rgba(c) for c in enmax_palette]))

mcolors.get_named_colors_mapping().update(cdict)
x=np.random.randn(100)
g = sns.distplot(x, color="green")

plt.show()

All codes shown here will produce the same plot in "the company's green" color:

🌐
Codecademy
codecademy.com › article › seaborn-design-ii
Seaborn Color Palettes: Complete Guide to Data Visualization Colors | Codecademy
These seaborn color palettes provide consistent styling across your Python data visualizations. You can also customize your palette by passing a list of colors in any valid Matplotlib format. This includes RGB tuples, hex color codes, or HTML color names, giving you full control over the visual ...
🌐
GitHub
github.com › mwaskom › seaborn › blob › master › seaborn › palettes.py
seaborn/seaborn/palettes.py at master · mwaskom/seaborn
color spaces that are handled by seaborn. You can also use the database · of named colors from the XKCD color survey. · If you are using a Jupyter notebook, you can also choose this palette · interactively with the :func:`choose_light_palette` function. · Parameters · ---------- color : base color for high values · hex code, html color name, or tuple in `input` space.
🌐
Background Remover
backgroundremover.com › home › color palettes › seaborn color palette
Seaborn Color Palette | HEX Codes & Color Inspiration | Background Remover
Download this color palette as a PDF file with all colors, names, and HEX codes. ... Explore complementary, analogous, and triadic color schemes based on the dominant color. ... The seaborn color palette is a carefully curated collection of 6harmonious colors designed to work together seamlessly.
🌐
Noga H. Rotman
r02b.github.io › seaborn_palettes
Seaborn Color Palettes and How to Use Them | Noga H. Rotman
November 8, 2022 - I personally prefer to use it, as seaborn palettes can be created as a list of HEX values, and generally it is an easy to use across multiple technical decks (Python / HTML / PowerPoint / …). Note that the HEX representation provided by Coolers is missing a starting #, so be sure to add that character to every color code...
Find elsewhere
🌐
PaletteCSS
palettecss.com › home › blog › seaborn color palette: a practical guide for python charts
Seaborn Color Palette: A Practical Guide for Python Charts
June 26, 2026 - If you build charts in Python, the seaborn color palette system is one of the easiest ways to make your visualisations look professional. Seaborn — the popular statistical plotting library built on Matplotlib — ships with a thoughtful set of palettes and makes it simple to apply your own. This guide covers the built-in options, when to use each type, and how to plug in custom colours from hex codes...
🌐
Moonbooks
en.moonbooks.org › Articles › How-to-extract-html-color-codes-hex-codes-from-a-seaborn-palette-
How to extract html color codes (hex codes) from a seaborn palette ?
To extract html color codes from a seaborn palette, a solution is to use the method as_hex(): How to extract html color codes (hex codes) from a seaborn palette ? >>> import seaborn as sns >>> pal = sns.color_palette("Blues") >>> print(pal.as_hex()) returns ·
🌐
w3tutorials
w3tutorials.net › blog › set-custom-seaborn-color-palette-using-hex-codes-and-name-the-colors
How to Set a Custom Seaborn Color Palette Using Hex Codes and Assign Easy-to-Use Names — w3tutorials.net
Seaborn offers built-in palettes like viridis (default), tab10, or pastel, but they lack customization for brand alignment or specific use cases. Hex codes (e.g., #1E40AF) are 6-character strings representing RGB color values (e.g., #RRGGBB).
🌐
DataCamp
datacamp.com › tutorial › seaborn-palettes
Seaborn Color Palette: Quick Guide to Picking Colors | DataCamp
September 30, 2024 - Creating a diverging palette with 12 colors. Image by Author. # Create a custom palette using HEX codes hex = sns.color_palette(["#FF6B6B", "#4ECDC4", "#45B7D1","#FAD02E", "#594F4F"])
🌐
GitHub
gist.github.com › yongrenjie › 0fcf6196ae97c72f76123d0513956a44
seaborn palettes for easy reference · GitHub
GIMP Palette Name: seaborn Columns: 27 0 0 0 black 255 255 255 white 76 114 176 deep1 221 132 82 deep2 85 168 104 deep3 196 78 82 deep4 129 114 179 deep5 147 120 96 deep6 218 139 195 deep7 140 140 140 deep8 204 185 116 deep9 100 181 205 deep10 ...
🌐
Seaborn
seaborn.pydata.org › generated › seaborn.light_palette.html
seaborn.light_palette — seaborn 0.13.2 documentation
The color parameter can be specified in a number of ways, including all options for defining a color in matplotlib and several additional color spaces that are handled by seaborn. You can also use the database of named colors from the XKCD color survey. If you are using a Jupyter notebook, you can also choose this palette interactively with the choose_light_palette() function. Parameters: colorbase color for high values · hex code, html color name, or tuple in input space.
🌐
Pythoncharts
pythoncharts.com › seaborn › seaborn-custom-color-palettes
Python Charts - Setting Custom Color Palettes in Seaborn
August 13, 2026 - Pass a list of hex codes straight to palette, one color per category. import matplotlib.pyplot as plt import seaborn as sns custom_colors = ["#264653", "#2a9d8f", "#e9c46a", "#f4a261", "#e76f51", "#a8dadc"] fig, ax = plt.subplots() ...
🌐
Seaborn
seaborn.pydata.org › generated › seaborn.blend_palette.html
seaborn.blend_palette — seaborn 0.13.2 documentation
seaborn.blend_palette(colors, n_colors=6, as_cmap=False, input='rgb')# Make a palette that blends between a list of colors. Parameters: colorssequence of colors in various formats interpreted by input · hex code, html color name, or tuple in input space. n_colorsint, optional ·
🌐
Reddit
reddit.com › r/learnpython › creating custom seaborn color palettes from only two hex codes? [question]
r/learnpython on Reddit: Creating Custom Seaborn Color Palettes from ONLY two Hex Codes? [Question]
July 5, 2020 -

Hi,

I am wondering if it is possible to create custom diverging seaborn color palettes by only giving it the starting and end colors.

So as an example, If I wanted Hex Code '#3877C7' to be the negative value and '#C75B38' to be the positive, is there a way to tell seaborn (or anything) this and have it automatically fill in the rest of the colors?

I know you can create custom palettes if you list off every combo you want, but that seems very manual if you are changing the two end colors often.

Thanks!

🌐
Biomooc
biomooc.com › color › seabornColors.html
seaborn colors - Biomooc
import seaborn as sns #sns.xkcd_rgb['pale red'] · plt.plot([1,2], lw=4, c=sns.xkcd_rgb['baby poop green'])
🌐
Medium
medium.com › data-science-collective › finding-the-best-color-blind-friendly-palette-on-python-seaborn-0546e4ed33f3
Finding the Best Color-blind Friendly Palette on Python Seaborn | by Boriharn K | Data Science Collective | Medium
August 9, 2025 - The next step is plotting these colors. We will use Seaborn’s color_palette function to get the Hex codes from each palette. The code below shows how to extract sixty-four colors from each one.