Mercurial > hg
comparison hgext/color.py @ 20455:a2c08adbb86e
color: add debugcolor command (issue4094)
This patch adds a debugcolor command that prints all
colors that the extension knows about.
author | Olle Lundberg <geek@nerd.sh> |
---|---|
date | Wed, 12 Feb 2014 01:00:51 +0100 |
parents | 3d8bfe2ecf6d |
children | 0084fcd5d7e2 |
comparison
equal
deleted
inserted
replaced
20454:47fd57f650e5 | 20455:a2c08adbb86e |
---|---|
424 # i18n: 'always', 'auto', and 'never' are keywords and should | 424 # i18n: 'always', 'auto', and 'never' are keywords and should |
425 # not be translated | 425 # not be translated |
426 _("when to colorize (boolean, always, auto, or never)"), | 426 _("when to colorize (boolean, always, auto, or never)"), |
427 _('TYPE'))) | 427 _('TYPE'))) |
428 | 428 |
429 def debugcolor(ui, repo, **opts): | |
430 global _styles | |
431 _styles = {} | |
432 for effect in _effects.keys(): | |
433 _styles[effect] = effect | |
434 ui.write(('colormode: %s\n') % ui._colormode) | |
435 ui.write(_('available colors:\n')) | |
436 for label, colors in _styles.items(): | |
437 ui.write(('%s\n') % colors, label=label) | |
438 | |
429 if os.name != 'nt': | 439 if os.name != 'nt': |
430 w32effects = None | 440 w32effects = None |
431 else: | 441 else: |
432 import re, ctypes | 442 import re, ctypes |
433 | 443 |
553 orig(m.group(2), **opts) | 563 orig(m.group(2), **opts) |
554 m = re.match(ansire, m.group(3)) | 564 m = re.match(ansire, m.group(3)) |
555 finally: | 565 finally: |
556 # Explicitly reset original attributes | 566 # Explicitly reset original attributes |
557 _kernel32.SetConsoleTextAttribute(stdout, origattr) | 567 _kernel32.SetConsoleTextAttribute(stdout, origattr) |
568 | |
569 cmdtable = { | |
570 'debugcolor': | |
571 (debugcolor, [], ('hg debugcolor')) | |
572 } |