summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2013-03-01 14:23:25 +0100
committerhut <hut@lavabit.com>2013-03-01 14:23:25 +0100
commit0dc29735c5fca3ee30bd216285264c355fbf832d (patch)
treeaee9c28a865b14d079ccffaa4502a8d75d6551d7 /ranger
parent102cc74ddb8f901f5c377916c82593d837726367 (diff)
downloadranger-0dc29735c5fca3ee30bd216285264c355fbf832d.tar.gz
gui.color: improved get_color
Diffstat (limited to 'ranger')
-rw-r--r--ranger/gui/color.py9
1 files 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