aboutsummaryrefslogtreecommitdiffstats
path: root/libmproxy/console.py
diff options
context:
space:
mode:
authorThomas Roth <code@leveldown.de>2010-02-26 00:20:49 +0100
committerThomas Roth <code@leveldown.de>2010-02-26 00:20:49 +0100
commit0e76f0f341f367abd3e317f48612071843977f3f (patch)
tree925766e4d0138b64fa7329761525e3705d6d7c3f /libmproxy/console.py
parentfc6f170731e2c9a21ffcaac5f0bb5f8156ccd1c9 (diff)
downloadmitmproxy-0e76f0f341f367abd3e317f48612071843977f3f.tar.gz
mitmproxy-0e76f0f341f367abd3e317f48612071843977f3f.tar.bz2
mitmproxy-0e76f0f341f367abd3e317f48612071843977f3f.zip
Added a 'keep terminal background' option (-t), so that you can use it with your own background color. (Foreground color following.)
Diffstat (limited to 'libmproxy/console.py')
-rw-r--r--libmproxy/console.py59
1 files changed, 34 insertions, 25 deletions
diff --git a/libmproxy/console.py b/libmproxy/console.py
index f666f71a..3cbc6173 100644
--- a/libmproxy/console.py
+++ b/libmproxy/console.py
@@ -714,30 +714,7 @@ class State:
#begin nocover
class ConsoleMaster(controller.Master):
- palette = [
- ('body', 'black', 'dark cyan', 'standout'),
- ('foot', 'light gray', 'black'),
- ('title', 'white', 'black',),
- ('editline', 'white', 'black',),
-
- # Help
- ('key', 'light cyan', 'black', 'underline'),
- ('head', 'white', 'black'),
- ('text', 'light gray', 'black'),
-
- # List and Connections
- ('method', 'dark cyan', 'black'),
- ('focus', 'yellow', 'black'),
- ('goodcode', 'light green', 'black'),
- ('error', 'light red', 'black'),
- ('header', 'dark cyan', 'black'),
- ('heading', 'white', 'dark blue'),
- ('inactive', 'dark gray', 'black'),
- ('ack', 'light red', 'black'),
-
- # Hex view
- ('offset', 'dark cyan', 'black'),
- ]
+ palette = []
footer_text_default = [
('key', "?"), ":help ",
('key', "q"), ":exit ",
@@ -747,7 +724,8 @@ class ConsoleMaster(controller.Master):
('key', "?"), ":help ",
('key', "q"), ":back ",
]
- def __init__(self, server, config):
+ def __init__(self, server, config, terminal_background):
+ self.set_palette(terminal_background)
controller.Master.__init__(self, server)
self.config = config
self.state = State()
@@ -755,6 +733,37 @@ class ConsoleMaster(controller.Master):
self.stickycookie = None
self.stickyhosts = {}
+ def set_palette(self, terminal_background):
+ if terminal_background:
+ background_color = 'default'
+ else:
+ background_color = 'black'
+
+ self.palette = [
+ ('body', 'black', 'dark cyan', 'standout'),
+ ('foot', 'light gray', background_color),
+ ('title', 'white', background_color,),
+ ('editline', 'white', background_color,),
+
+ # Help
+ ('key', 'light cyan', background_color, 'underline'),
+ ('head', 'white', background_color),
+ ('text', 'light gray', background_color),
+
+ # List and Connections
+ ('method', 'dark cyan', background_color),
+ ('focus', 'yellow', background_color),
+ ('goodcode', 'light green', background_color),
+ ('error', 'light red', background_color),
+ ('header', 'dark cyan', background_color),
+ ('heading', 'white', 'dark blue'),
+ ('inactive', 'dark gray', background_color),
+ ('ack', 'light red', background_color),
+
+ # Hex view
+ ('offset', 'dark cyan', background_color),
+ ]
+
def run(self):
self.ui = urwid.curses_display.Screen()
self.ui.register_palette(self.palette)