ui/urwid: respect --no-colors

This commit is contained in:
rr-
2019-01-13 17:46:07 +01:00
parent a47d6233be
commit ae99f1f1a4
2 changed files with 14 additions and 3 deletions
+13 -2
View File
@@ -13,7 +13,7 @@ from ..base import BaseUserInterface
TICK_FREQ = 0.1
SAVE_FREQ = 60.0
PALETTE: T.List[T.Tuple[str, ...]] = [
PALETTE_COLORS: T.List[T.Tuple[str, ...]] = [
("logo", "light green", ""),
("button", "", ""),
("button-focus", "light red", "black"),
@@ -29,6 +29,13 @@ PALETTE: T.List[T.Tuple[str, ...]] = [
("scrollable", "", ""),
("scrollable-focus", "", ""),
]
PALETTE_NO_COLORS: T.List[T.Tuple[str, ...]] = [
("button-focus", "", "", "standout"),
("linebox-focus", "", "", "standout"),
("progressbar-normal", "black", "white"),
("progressbar-done", "black", "white", "standout"),
("progressbar-smooth", "black", "white"),
]
class ConfirmExitDialog(ConfirmView):
@@ -54,8 +61,12 @@ class UrwidUserInterface(BaseUserInterface):
bind_commands()
self.loop = urwid.MainLoop(
None, PALETTE, unhandled_input=self.unhandled_input
None,
PALETTE_COLORS if args.colors else PALETTE_NO_COLORS,
unhandled_input=self.unhandled_input,
)
if not args.colors:
self.loop.screen.set_terminal_properties(1)
self.old_views: T.List[urwid.Widget] = []
self.switch_to_roster_view()