color: add debugcolor command (issue4094)
This patch adds a debugcolor command that prints all
colors that the extension knows about.
--- 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'))
+}