@@ -3022,23 +3022,26 @@ def register_colors(nmax=np.inf):
30223022 if i == 0 :
30233023 paths = [ # be explicit because categories matter!
30243024 os .path .join (path , base )
3025- for base in ('xkcd.txt' , 'crayola.txt' , 'open .txt' )
3025+ for base in ('xkcd.txt' , 'crayola.txt' , 'opencolor .txt' )
30263026 ]
30273027 else :
30283028 paths = sorted (glob .glob (os .path .join (path , '*.txt' )))
30293029 for file in paths :
30303030 cat , _ = os .path .splitext (os .path .basename (file ))
30313031 with open (file , 'r' ) as f :
3032- pairs = [tuple (item .strip () for item in line .split (':' ))
3033- for line in f .readlines () if line .strip ()]
3032+ pairs = [
3033+ tuple (item .strip () for item in line .split (':' ))
3034+ for line in f .readlines ()
3035+ if line .strip () and line .strip ()[0 ] != '#'
3036+ ]
30343037 if not all (len (pair ) == 2 for pair in pairs ):
30353038 raise RuntimeError (
30363039 f'Invalid color names file { file !r} . '
30373040 f'Every line must be formatted as "name: color".'
30383041 )
30393042
30403043 # Categories for which we add *all* colors
3041- if cat == 'open ' or i == 1 :
3044+ if cat == 'opencolor ' or i == 1 :
30423045 dict_ = {name : color for name , color in pairs }
30433046 mcolors .colorConverter .colors .update (dict_ )
30443047 colors [cat ] = sorted (dict_ )
@@ -3430,8 +3433,8 @@ def _color_filter(i, hcl): # noqa: E306
34303433 figs = []
34313434 from . import subplots
34323435 for cats in (
3433- ('open ' ,),
3434- tuple (name for name in colors if name not in ('css' , 'open ' ))
3436+ ('opencolor ' ,),
3437+ tuple (name for name in colors if name not in ('css' , 'opencolor ' ))
34353438 ):
34363439 # Dictionary of colors for that category
34373440 data = {}
@@ -3441,7 +3444,7 @@ def _color_filter(i, hcl): # noqa: E306
34413444
34423445 # Group colors together by discrete range of hue, then sort by value
34433446 # For opencolors this is not necessary
3444- if cats == ('open ' ,):
3447+ if cats == ('opencolor ' ,):
34453448 wscale = 0.5
34463449 swatch = 1.5
34473450 nrows , ncols = 10 , len (COLORS_OPEN ) # rows and columns
0 commit comments