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
lavabit.com> 2009-12-12 03:08:36 +0100 updated UML project' href='/akspecs/ranger/commit/uml/134530.diagram?h=v1.9.0b1&id=61de0a4defd3fe275f6f51fe81f362b0adbdf382'>61de0a4d ^
cfbb8c84 ^
61de0a4d ^
cfbb8c84 ^
61de0a4d ^
cfbb8c84 ^
61de0a4d ^
cfbb8c84 ^
61de0a4d ^
cfbb8c84 ^
61de0a4d ^
cfbb8c84 ^
61de0a4d ^
cfbb8c84 ^
61de0a4d ^
cfbb8c84 ^
61de0a4d ^
cfbb8c84 ^
61de0a4d ^
cfbb8c84 ^
61de0a4d ^
cfbb8c84 ^
61de0a4d ^
cfbb8c84 ^
61de0a4d ^


cfbb8c84 ^
61de0a4d ^
cfbb8c84 ^
61de0a4d ^
cfbb8c84 ^
61de0a4d ^
cfbb8c84 ^
61de0a4d ^
cfbb8c84 ^
61de0a4d ^
cfbb8c84 ^
61de0a4d ^
9f186528 ^
61de0a4d ^
9f186528 ^
61de0a4d ^
9f186528 ^
8db3c4b1 ^
9f186528 ^
69a0e827 ^
9f186528 ^
61de0a4d ^
9f186528 ^
61de0a4d ^
9f186528 ^
61de0a4d ^
9f186528 ^
61de0a4d ^
9f186528 ^
61de0a4d ^


cfbb8c84 ^
61de0a4d ^

69a0e827 ^



61de0a4d ^


cfbb8c84 ^


61de0a4d ^

cfbb8c84 ^


61de0a4d ^



cfbb8c84 ^


61de0a4d ^



cfbb8c84 ^


61de0a4d ^

cfbb8c84 ^


61de0a4d ^


cfbb8c84 ^


61de0a4d ^


cfbb8c84 ^


61de0a4d ^


cfbb8c84 ^


61de0a4d ^

cfbb8c84 ^


61de0a4d ^

cfbb8c84 ^


61de0a4d ^



cfbb8c84 ^


61de0a4d ^



9f186528 ^


61de0a4d ^

9f186528 ^


61de0a4d ^

9f186528 ^


61de0a4d ^


9f186528 ^


61de0a4d ^

9f186528 ^


61de0a4d ^

9f186528 ^


61de0a4d ^


9f186528 ^


69a0e827 ^









cfbb8c84 ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191