534 # i18n: 'always', 'auto', 'never', and 'debug' are keywords |
534 # i18n: 'always', 'auto', 'never', and 'debug' are keywords |
535 # and should not be translated |
535 # and should not be translated |
536 _("when to colorize (boolean, always, auto, never, or debug)"), |
536 _("when to colorize (boolean, always, auto, never, or debug)"), |
537 _('TYPE'))) |
537 _('TYPE'))) |
538 |
538 |
539 @command('debugcolor', [], 'hg debugcolor') |
539 @command('debugcolor', |
|
540 [('', 'style', None, _('show all configured styles'))], |
|
541 'hg debugcolor') |
540 def debugcolor(ui, repo, **opts): |
542 def debugcolor(ui, repo, **opts): |
541 """show available colors and effects""" |
543 """show available color, effects or style""" |
542 ui.write(('color mode: %s\n') % ui._colormode) |
544 ui.write(('color mode: %s\n') % ui._colormode) |
543 return _debugdisplaycolor(ui) |
545 if opts.get('style'): |
|
546 return _debugdisplaystyle(ui) |
|
547 else: |
|
548 return _debugdisplaycolor(ui) |
544 |
549 |
545 def _debugdisplaycolor(ui): |
550 def _debugdisplaycolor(ui): |
546 global _styles |
551 global _styles |
547 oldstyle = _styles |
552 oldstyle = _styles |
548 try: |
553 try: |
561 key=lambda i: ('_' in i[0], i[0], i[1])) |
566 key=lambda i: ('_' in i[0], i[0], i[1])) |
562 for colorname, label in items: |
567 for colorname, label in items: |
563 ui.write(('%s\n') % colorname, label=label) |
568 ui.write(('%s\n') % colorname, label=label) |
564 finally: |
569 finally: |
565 _styles = oldstyle |
570 _styles = oldstyle |
|
571 |
|
572 def _debugdisplaystyle(ui): |
|
573 ui.write(_('available style:\n')) |
|
574 width = max(len(s) for s in _styles) |
|
575 for label, effects in sorted(_styles.items()): |
|
576 ui.write('%s' % label, label=label) |
|
577 if effects: |
|
578 # 50 |
|
579 ui.write(': ') |
|
580 ui.write(' ' * (max(0, width - len(label)))) |
|
581 ui.write(', '.join(ui.label(e, e) for e in effects.split())) |
|
582 ui.write('\n') |
566 |
583 |
567 if os.name != 'nt': |
584 if os.name != 'nt': |
568 w32effects = None |
585 w32effects = None |
569 else: |
586 else: |
570 import ctypes |
587 import ctypes |