summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorhut <hut@lepus.uberspace.de>2015-08-04 12:13:24 +0200
committerhut <hut@lepus.uberspace.de>2015-08-04 12:13:24 +0200
commitefd3ef7c69f5fa8cb09eace71b3d3ce1d5806680 (patch)
tree3a75401ae2de9820b61b9ba85c616e8486ca515e /ranger
parentb880d02d3aebb12eb1a12b9242ff643eefa24256 (diff)
downloadranger-efd3ef7c69f5fa8cb09eace71b3d3ce1d5806680.tar.gz
gui.color: don't crash when colors aren't supported
Diffstat (limited to 'ranger')
-rw-r--r--ranger/gui/color.py7
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]