From efd3ef7c69f5fa8cb09eace71b3d3ce1d5806680 Mon Sep 17 00:00:00 2001 From: hut Date: Tue, 4 Aug 2015 12:13:24 +0200 Subject: gui.color: don't crash when colors aren't supported --- ranger/gui/color.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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] -- cgit 1.4.1-2-gfad0