diff --git a/doc/jp/debug.rst b/doc/jp/debug.rst index 79338b11..c7ee0f80 100644 --- a/doc/jp/debug.rst +++ b/doc/jp/debug.rst @@ -77,3 +77,17 @@ example 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 --git a/sat_frontends/jp/cmd_debug.py b/sat_frontends/jp/cmd_debug.py index bd5161f8..732291e8 100644 --- a/sat_frontends/jp/cmd_debug.py +++ b/sat_frontends/jp/cmd_debug.py @@ -187,8 +187,34 @@ class Monitor(base.CommandBase): 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__(