From 0dc29735c5fca3ee30bd216285264c355fbf832d Mon Sep 17 00:00:00 2001 From: hut Date: Fri, 1 Mar 2013 14:23:25 +0100 Subject: gui.color: improved get_color --- ranger/gui/color.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/ranger/gui/color.py b/ranger/gui/color.py index 6c73f99a..b118a0af 100644 --- a/ranger/gui/color.py +++ b/ranger/gui/color.py @@ -20,14 +20,13 @@ COLOR_PAIRS = {10: 0} def get_color(fg, bg): """Returns the curses color pair for the given fg/bg combination.""" - c = bg+2 + 9*(fg + 2) - - if c not in COLOR_PAIRS: + key = (fg, bg) + if key not in COLOR_PAIRS: size = len(COLOR_PAIRS) curses.init_pair(size, fg, bg) - COLOR_PAIRS[c] = size + COLOR_PAIRS[key] = size - return COLOR_PAIRS[c] + return COLOR_PAIRS[key] black = curses.COLOR_BLACK blue = curses.COLOR_BLUE -- cgit 1.4.1-2-gfad0