diff options
author | hut <hut@lepus.uberspace.de> | 2015-08-04 12:13:24 +0200 |
---|---|---|
committer | hut <hut@lepus.uberspace.de> | 2015-10-04 01:21:57 +0200 |
commit | 2aa3b9dd82b64e79a3d4027727afbbb881ccb3b3 (patch) | |
tree | 37a24b8304fc7fea40dd08e39d1276ec46e5edb6 /ranger | |
parent | a14663243487dfe62e6bf16dddeb2a0fe3885d5d (diff) | |
download | ranger-2aa3b9dd82b64e79a3d4027727afbbb881ccb3b3.tar.gz |
gui.color: don't crash when colors aren't supported
Diffstat (limited to 'ranger')
-rw-r--r-- | ranger/gui/color.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/ranger/gui/color.py b/ranger/gui/color.py index 2fa68a33..89b58092 100644 --- a/ranger/gui/color.py +++ b/ranger/gui/color.py @@ -35,7 +35,12 @@ def get_color(fg, bg): fg = DEFAULT_FOREGROUND if bg == -1: # -1 is the "default" color bg = DEFAULT_BACKGROUND - curses.init_pair(size, fg, bg) + + try: + curses.init_pair(size, fg, bg) + except: + # If this fails too, colors are probably not supported + pass COLOR_PAIRS[key] = size return COLOR_PAIRS[key] |