Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 010be02

Browse files
committed
MNT: normalize X11/CSS/HTML colors
- removed darksage, lightsage, sage which are colors we added in 1ac590e These colors are now included in the XKCD mapping - correct sandybrown which mpl had as '#FAA460' but should be '#F4A460' according to the w3 group, wikipedia, the copy of rgb.txt bundled in the emacs source, and the mapping that we had bundled with AGG for a while. The original value goes back to ec45d17
1 parent 605a8af commit 010be02

2 files changed

Lines changed: 16 additions & 16 deletions

File tree

lib/matplotlib/_color_data.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -962,7 +962,8 @@
962962
'purple': '#7e1e9c'}
963963

964964

965-
X11_COLORS = {
965+
# https://drafts.csswg.org/css-color-4/#named-colors
966+
CSS4_COLORS = {
966967
'aliceblue': '#F0F8FF',
967968
'antiquewhite': '#FAEBD7',
968969
'aqua': '#00FFFF',
@@ -989,22 +990,24 @@
989990
'darkgoldenrod': '#B8860B',
990991
'darkgray': '#A9A9A9',
991992
'darkgreen': '#006400',
993+
'darkgrey': '#A9A9A9',
992994
'darkkhaki': '#BDB76B',
993995
'darkmagenta': '#8B008B',
994996
'darkolivegreen': '#556B2F',
995997
'darkorange': '#FF8C00',
996998
'darkorchid': '#9932CC',
997999
'darkred': '#8B0000',
998-
'darksage': '#598556',
9991000
'darksalmon': '#E9967A',
10001001
'darkseagreen': '#8FBC8F',
10011002
'darkslateblue': '#483D8B',
10021003
'darkslategray': '#2F4F4F',
1004+
'darkslategrey': '#2F4F4F',
10031005
'darkturquoise': '#00CED1',
10041006
'darkviolet': '#9400D3',
10051007
'deeppink': '#FF1493',
10061008
'deepskyblue': '#00BFFF',
10071009
'dimgray': '#696969',
1010+
'dimgrey': '#696969',
10081011
'dodgerblue': '#1E90FF',
10091012
'firebrick': '#B22222',
10101013
'floralwhite': '#FFFAF0',
@@ -1017,6 +1020,7 @@
10171020
'gray': '#808080',
10181021
'green': '#008000',
10191022
'greenyellow': '#ADFF2F',
1023+
'grey': '#808080',
10201024
'honeydew': '#F0FFF0',
10211025
'hotpink': '#FF69B4',
10221026
'indianred': '#CD5C5C',
@@ -1031,14 +1035,15 @@
10311035
'lightcoral': '#F08080',
10321036
'lightcyan': '#E0FFFF',
10331037
'lightgoldenrodyellow': '#FAFAD2',
1034-
'lightgreen': '#90EE90',
10351038
'lightgray': '#D3D3D3',
1039+
'lightgreen': '#90EE90',
1040+
'lightgrey': '#D3D3D3',
10361041
'lightpink': '#FFB6C1',
1037-
'lightsage': '#BCECAC',
10381042
'lightsalmon': '#FFA07A',
10391043
'lightseagreen': '#20B2AA',
10401044
'lightskyblue': '#87CEFA',
10411045
'lightslategray': '#778899',
1046+
'lightslategrey': '#778899',
10421047
'lightsteelblue': '#B0C4DE',
10431048
'lightyellow': '#FFFFE0',
10441049
'lime': '#00FF00',
@@ -1078,20 +1083,21 @@
10781083
'plum': '#DDA0DD',
10791084
'powderblue': '#B0E0E6',
10801085
'purple': '#800080',
1086+
'rebeccapurple': '#663399',
10811087
'red': '#FF0000',
10821088
'rosybrown': '#BC8F8F',
10831089
'royalblue': '#4169E1',
10841090
'saddlebrown': '#8B4513',
10851091
'salmon': '#FA8072',
1086-
'sage': '#87AE73',
1087-
'sandybrown': '#FAA460',
1092+
'sandybrown': '#F4A460',
10881093
'seagreen': '#2E8B57',
10891094
'seashell': '#FFF5EE',
10901095
'sienna': '#A0522D',
10911096
'silver': '#C0C0C0',
10921097
'skyblue': '#87CEEB',
10931098
'slateblue': '#6A5ACD',
10941099
'slategray': '#708090',
1100+
'slategrey': '#708090',
10951101
'snow': '#FFFAFA',
10961102
'springgreen': '#00FF7F',
10971103
'steelblue': '#4682B4',
@@ -1106,9 +1112,3 @@
11061112
'whitesmoke': '#F5F5F5',
11071113
'yellow': '#FFFF00',
11081114
'yellowgreen': '#9ACD32'}
1109-
1110-
# add british equivs to X11 colors
1111-
for k, v in list(six.iteritems(X11_COLORS)):
1112-
if k.find('gray') >= 0:
1113-
k = k.replace('gray', 'grey')
1114-
X11_COLORS[k] = v

lib/matplotlib/colors.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,13 @@
5656
import numpy as np
5757
from numpy import ma
5858
import matplotlib.cbook as cbook
59-
from ._color_data import X11_COLORS, XKCD_COLORS
59+
from ._color_data import XKCD_COLORS, CSS4_COLORS
6060

6161
# for back copatibility
62-
cnames = X11_COLORS
62+
cnames = CSS4_COLORS
6363

64-
COLOR_NAMES = {'x11': X11_COLORS,
65-
'xkcd': XKCD_COLORS}
64+
COLOR_NAMES = {'xkcd': XKCD_COLORS,
65+
'css4': CSS4_COLORS}
6666

6767

6868
def is_color_like(c):

0 commit comments

Comments
 (0)