@@ -642,7 +642,7 @@ def register_cycles(*args, user=None, default=False):
642642
643643
644644@docstring ._snippet_manager
645- def register_colors (* args , user = None , default = False , space = 'hcl' , margin = 0.1 , ** kwargs ):
645+ def register_colors (* args , user = None , default = False , space = None , margin = None , ** kwargs ):
646646 """
647647 Register named colors. This is called on import.
648648
@@ -651,13 +651,15 @@ def register_colors(*args, user=None, default=False, space='hcl', margin=0.1, **
651651 %(rc.color_args)s
652652 %(rc.color_params)s
653653 space : {'hcl', 'hsl', 'hpl'}, optional
654- Ignored if `default` is ``False``. The colorspace used to select "perceptually
655- distinct" colors from the XKCD `color survey <https://xkcd.com/color/rgb/>`_.
654+ The colorspace used to select "perceptually distinct" colors from the XKCD
655+ `color survey <https://xkcd.com/color/rgb/>`__. Default is ``'hcl'``. If
656+ passed then `default` is set to ``True``.
656657 margin : float, optional
657- Ignored if `default` is ``False``. The margin by which the normalized hue,
658- saturation, and luminance of each XKCD color must differ from the channel
659- values of the other XKCD colors to be deemed "perceptually distinct" and
660- registered. Must be between ``0`` and ``1``. ``0`` will register all colors.
658+ The margin by which the normalized hue, saturation, and luminance of each
659+ XKCD color must differ from the channel values of the other XKCD colors to
660+ be deemed "perceptually distinct" and registered. Must fall between ``0``
661+ and ``1`` (``0`` will register all colors). Default is ``0.1``. If
662+ passed then `default` is set to ``True``.
661663 **kwargs
662664 Additional color name specifications passed as keyword arguments rather
663665 than positional dictionaries.
@@ -671,6 +673,9 @@ def register_colors(*args, user=None, default=False, space='hcl', margin=0.1, **
671673 """
672674 # Add in base colors and CSS4 colors so user has no surprises
673675 from . import colors as pcolors
676+ default = _not_none (space is not None , margin is not None , default )
677+ margin = _not_none (margin , 0.1 )
678+ space = _not_none (space , 'hcl' )
674679 if default :
675680 pcolors ._color_database .clear () # MutableMapping ensures cache also clears
676681 for src in (mcolors .CSS4_COLORS , pcolors .COLORS_BASE ):
@@ -708,7 +713,7 @@ def register_colors(*args, user=None, default=False, space='hcl', margin=0.1, **
708713
709714 # Add xkcd colors after filtering
710715 elif cat == 'xkcd' :
711- loaded = pcolors ._standardize_colors (loaded , space = space , margin = margin )
716+ loaded = pcolors ._standardize_colors (loaded , space , margin )
712717 pcolors ._color_database .update (loaded )
713718 pcolors .COLORS_XKCD .update (loaded )
714719
0 commit comments