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:

python - Extract RGB or 6 digit code from Seaborn palette - Stack Overflow
Creating Custom Seaborn Color Palettes from ONLY two Hex Codes? [Question]
All seaborn color palettes together, so you don't have to search for them everytime
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.comIf by "6 digit code" you mean a hex code, you can also do:
pal = sns.color_palette(...)
pal.as_hex()
The values you are getting are percentages of 255, the max RGB value. Just multiply each triplet of values by 255 (and round off, if you like) to get the RGB values.
for color in color_list:
for value in color:
value *= 255
Then store those in a new list to have your list of RGB values.
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!