Skip to content

Commit b078ed0

Browse files
committed
Merge pull request mwaskom#490 from mwaskom/crayon_colors
Add seaborn.crayons and crayon_palette to use Crayola colors
2 parents 9a1db37 + bea35db commit b078ed0

File tree

6 files changed

+147
-0
lines changed

6 files changed

+147
-0
lines changed

doc/api.rst

+1
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ Color palettes
109109
diverging_palette
110110
blend_palette
111111
xkcd_palette
112+
crayon_palette
112113
mpl_palette
113114

114115
Palette widgets

doc/releases/v0.6.0.txt

+2
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ New plotting functions
4343
Other additions
4444
~~~~~~~~~~~~~~~
4545

46+
- Added the ``seaborn.crayons`` dictionary and the :func:`crayon_palette` function to define colors from the 120 box (!) of `Crayola crayons <http://en.wikipedia.org/wiki/List_of_Crayola_crayon_colors>`_.
47+
4648
- Added the ``line_kws`` parameter to :func:`residplot` to change the style of the lowess line, when used.
4749

4850
- Added open-ended ``**kwargs`` to the ``add_legend`` method on :class:`FacetGrid` and :class:`PairGrid`, which will pass additional keyword arguments through when calling the legend function on the ``Figure`` or ``Axes``.

seaborn/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from .miscplot import *
1010
from .axisgrid import *
1111
from .xkcd_rgb import xkcd_rgb
12+
from .crayons import crayons
1213
set()
1314

1415
__version__ = "0.6.dev"

seaborn/crayons.py

+120
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
crayons = {'Almond': '#EFDECD',
2+
'Antique Brass': '#CD9575',
3+
'Apricot': '#FDD9B5',
4+
'Aquamarine': '#78DBE2',
5+
'Asparagus': '#87A96B',
6+
'Atomic Tangerine': '#FFA474',
7+
'Banana Mania': '#FAE7B5',
8+
'Beaver': '#9F8170',
9+
'Bittersweet': '#FD7C6E',
10+
'Black': '#000000',
11+
'Blue': '#1F75FE',
12+
'Blue Bell': '#A2A2D0',
13+
'Blue Green': '#0D98BA',
14+
'Blue Violet': '#7366BD',
15+
'Blush': '#DE5D83',
16+
'Brick Red': '#CB4154',
17+
'Brown': '#B4674D',
18+
'Burnt Orange': '#FF7F49',
19+
'Burnt Sienna': '#EA7E5D',
20+
'Cadet Blue': '#B0B7C6',
21+
'Canary': '#FFFF99',
22+
'Caribbean Green': '#00CC99',
23+
'Carnation Pink': '#FFAACC',
24+
'Cerise': '#DD4492',
25+
'Cerulean': '#1DACD6',
26+
'Chestnut': '#BC5D58',
27+
'Copper': '#DD9475',
28+
'Cornflower': '#9ACEEB',
29+
'Cotton Candy': '#FFBCD9',
30+
'Dandelion': '#FDDB6D',
31+
'Denim': '#2B6CC4',
32+
'Desert Sand': '#EFCDB8',
33+
'Eggplant': '#6E5160',
34+
'Electric Lime': '#CEFF1D',
35+
'Fern': '#71BC78',
36+
'Forest Green': '#6DAE81',
37+
'Fuchsia': '#C364C5',
38+
'Fuzzy Wuzzy': '#CC6666',
39+
'Gold': '#E7C697',
40+
'Goldenrod': '#FCD975',
41+
'Granny Smith Apple': '#A8E4A0',
42+
'Gray': '#95918C',
43+
'Green': '#1CAC78',
44+
'Green Yellow': '#F0E891',
45+
'Hot Magenta': '#FF1DCE',
46+
'Inchworm': '#B2EC5D',
47+
'Indigo': '#5D76CB',
48+
'Jazzberry Jam': '#CA3767',
49+
'Jungle Green': '#3BB08F',
50+
'Laser Lemon': '#FEFE22',
51+
'Lavender': '#FCB4D5',
52+
'Macaroni and Cheese': '#FFBD88',
53+
'Magenta': '#F664AF',
54+
'Mahogany': '#CD4A4C',
55+
'Manatee': '#979AAA',
56+
'Mango Tango': '#FF8243',
57+
'Maroon': '#C8385A',
58+
'Mauvelous': '#EF98AA',
59+
'Melon': '#FDBCB4',
60+
'Midnight Blue': '#1A4876',
61+
'Mountain Meadow': '#30BA8F',
62+
'Navy Blue': '#1974D2',
63+
'Neon Carrot': '#FFA343',
64+
'Olive Green': '#BAB86C',
65+
'Orange': '#FF7538',
66+
'Orchid': '#E6A8D7',
67+
'Outer Space': '#414A4C',
68+
'Outrageous Orange': '#FF6E4A',
69+
'Pacific Blue': '#1CA9C9',
70+
'Peach': '#FFCFAB',
71+
'Periwinkle': '#C5D0E6',
72+
'Piggy Pink': '#FDDDE6',
73+
'Pine Green': '#158078',
74+
'Pink Flamingo': '#FC74FD',
75+
'Pink Sherbert': '#F78FA7',
76+
'Plum': '#8E4585',
77+
'Purple Heart': '#7442C8',
78+
"Purple Mountains' Majesty": '#9D81BA',
79+
'Purple Pizzazz': '#FE4EDA',
80+
'Radical Red': '#FF496C',
81+
'Raw Sienna': '#D68A59',
82+
'Razzle Dazzle Rose': '#FF48D0',
83+
'Razzmatazz': '#E3256B',
84+
'Red': '#EE204D',
85+
'Red Orange': '#FF5349',
86+
'Red Violet': '#C0448F',
87+
"Robin's Egg Blue": '#1FCECB',
88+
'Royal Purple': '#7851A9',
89+
'Salmon': '#FF9BAA',
90+
'Scarlet': '#FC2847',
91+
"Screamin' Green": '#76FF7A',
92+
'Sea Green': '#93DFB8',
93+
'Sepia': '#A5694F',
94+
'Shadow': '#8A795D',
95+
'Shamrock': '#45CEA2',
96+
'Shocking Pink': '#FB7EFD',
97+
'Silver': '#CDC5C2',
98+
'Sky Blue': '#80DAEB',
99+
'Spring Green': '#ECEABE',
100+
'Sunglow': '#FFCF48',
101+
'Sunset Orange': '#FD5E53',
102+
'Tan': '#FAA76C',
103+
'Tickle Me Pink': '#FC89AC',
104+
'Timberwolf': '#DBD7D2',
105+
'Tropical Rain Forest': '#17806D',
106+
'Tumbleweed': '#DEAA88',
107+
'Turquoise Blue': '#77DDE7',
108+
'Unmellow Yellow': '#FFFF66',
109+
'Violet (Purple)': '#926EAE',
110+
'Violet Red': '#F75394',
111+
'Vivid Tangerine': '#FFA089',
112+
'Vivid Violet': '#8F509D',
113+
'White': '#FFFFFF',
114+
'Wild Blue Yonder': '#A2ADD0',
115+
'Wild Strawberry': '#FF43A4',
116+
'Wild Watermelon': '#FC6C85',
117+
'Wisteria': '#CDA4DE',
118+
'Yellow': '#FCE883',
119+
'Yellow Green': '#C5E384',
120+
'Yellow Orange': '#FFAE42'}

seaborn/palettes.py

+14
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
from .utils import desaturate, set_hls_values
1515
from .xkcd_rgb import xkcd_rgb
16+
from .crayons import crayons
1617
from .miscplot import palplot
1718

1819

@@ -442,6 +443,19 @@ def xkcd_palette(colors):
442443
return color_palette(palette, len(palette))
443444

444445

446+
def crayon_palette(colors):
447+
"""Make a palette with color names from Crayola crayons.
448+
449+
Colors are taken from here:
450+
http://en.wikipedia.org/wiki/List_of_Crayola_crayon_colors
451+
452+
This is just a simple wrapper around the seaborn.crayons dictionary.
453+
454+
"""
455+
palette = [crayons[name] for name in colors]
456+
return color_palette(palette, len(palette))
457+
458+
445459
def cubehelix_palette(n_colors=6, start=0, rot=.4, gamma=1.0, hue=0.8,
446460
light=.85, dark=.15, reverse=False, as_cmap=False):
447461
"""Make a sequential palette from the cubehelix system.

seaborn/tests/test_palettes.py

+9
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
from .. import palettes, utils, rcmod, husl
99
from ..xkcd_rgb import xkcd_rgb
10+
from ..crayons import crayons
1011

1112

1213
class TestColorPalettes(object):
@@ -252,3 +253,11 @@ def test_xkcd_palette(self):
252253
for name, color in zip(names, colors):
253254
as_hex = mpl.colors.rgb2hex(color)
254255
nt.assert_equal(as_hex, xkcd_rgb[name])
256+
257+
def test_crayon_palette(self):
258+
259+
names = list(crayons.keys())[10:15]
260+
colors = palettes.crayon_palette(names)
261+
for name, color in zip(names, colors):
262+
as_hex = mpl.colors.rgb2hex(color)
263+
nt.assert_equal(as_hex, crayons[name].lower())

0 commit comments

Comments
 (0)