# HG changeset patch # User Olle Lundberg # Date 1392163251 -3600 # Node ID a2c08adbb86ed8e65897ce35ec97ee947f26d2dd # Parent 47fd57f650e5d91ce85b379c292e5c2b280c1a46 color: add debugcolor command (issue4094) This patch adds a debugcolor command that prints all colors that the extension knows about. diff -r 47fd57f650e5 -r a2c08adbb86e hgext/color.py --- a/hgext/color.py Thu Jan 30 16:47:29 2014 -0800 +++ b/hgext/color.py Wed Feb 12 01:00:51 2014 +0100 @@ -426,6 +426,16 @@ _("when to colorize (boolean, always, auto, or never)"), _('TYPE'))) +def debugcolor(ui, repo, **opts): + global _styles + _styles = {} + for effect in _effects.keys(): + _styles[effect] = effect + ui.write(('colormode: %s\n') % ui._colormode) + ui.write(_('available colors:\n')) + for label, colors in _styles.items(): + ui.write(('%s\n') % colors, label=label) + if os.name != 'nt': w32effects = None else: @@ -555,3 +565,8 @@ finally: # Explicitly reset original attributes _kernel32.SetConsoleTextAttribute(stdout, origattr) + +cmdtable = { + 'debugcolor': + (debugcolor, [], ('hg debugcolor')) +}