# HG changeset patch # User Goffi # Date 1569962951 -7200 # Node ID cf843dd7c345a4dba147284caac173ccdf622649 # Parent d9f328374473ef40fd35c5ff483bb0998302b6e0 jp (debug): new "theme" command to print colour theme according to `background` value: fix 321 diff -r d9f328374473 -r cf843dd7c345 doc/jp/debug.rst --- a/doc/jp/debug.rst Tue Oct 01 22:49:10 2019 +0200 +++ b/doc/jp/debug.rst Tue Oct 01 22:49:11 2019 +0200 @@ -77,3 +77,17 @@ Monitor raw XML stream:: $ jp debug monitor -v + +theme +===== + +Show the colour constants in their respective colour, according to background (``light`` +or ``dark``). If backround option is not set in ``sat.conf``, it will be autodetected, and +colour theme will be modified accordingly. + +example +------- + +Show colours with the set background:: + + $ jp debug theme diff -r d9f328374473 -r cf843dd7c345 sat_frontends/jp/cmd_debug.py --- a/sat_frontends/jp/cmd_debug.py Tue Oct 01 22:49:10 2019 +0200 +++ b/sat_frontends/jp/cmd_debug.py Tue Oct 01 22:49:11 2019 +0200 @@ -187,8 +187,34 @@ self.host.bridge.register_signal("xmlLog", self.printXML, "plugin") +class Theme(base.CommandBase): + def __init__(self, host): + base.CommandBase.__init__( + self, host, "theme", help=_("print colours used with your background") + ) + + def add_parser_options(self): + pass + + async def start(self): + for attr in dir(C): + if not attr.startswith('A_'): + continue + color = getattr(C, attr) + if attr == 'A_LEVEL_COLORS': + # This constant contains multiple colors + self.disp('LEVEL COLORS: ', no_lf=True) + for idx, c in enumerate(color): + last = idx == len(color)-1 + self.disp(c + f'LEVEL_{idx}' + A.RESET + (', ' if not last else ''), no_lf=not last) + else: + text = attr[2:] + self.disp(A.color(color, text)) + self.host.quit() + + class Debug(base.CommandBase): - subcommands = (Bridge, Monitor) + subcommands = (Bridge, Monitor, Theme) def __init__(self, host): super(Debug, self).__init__(