diff options
author | hut <hut@lepus.uberspace.de> | 2015-08-04 12:13:24 +0200 |
---|---|---|
committer | hut <hut@lepus.uberspace.de> | 2015-08-04 12:13:24 +0200 |
commit | efd3ef7c69f5fa8cb09eace71b3d3ce1d5806680 (patch) | |
tree | 3a75401ae2de9820b61b9ba85c616e8486ca515e /ranger | |
parent | b880d02d3aebb12eb1a12b9242ff643eefa24256 (diff) | |
download | ranger-efd3ef7c69f5fa8cb09eace71b3d3ce1d5806680.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] |