File tree Expand file tree Collapse file tree 1 file changed +15
-6
lines changed Expand file tree Collapse file tree 1 file changed +15
-6
lines changed Original file line number Diff line number Diff line change 1
- import curtsies .termformatconstants
2
1
import re
3
2
4
3
from curtsies .formatstring import fmtstr , FmtStr
5
- from curtsies .termformatconstants import FG_COLORS , BG_COLORS
4
+ from curtsies .termformatconstants import (
5
+ FG_COLORS ,
6
+ BG_COLORS ,
7
+ colors as CURTSIES_COLORS ,
8
+ )
6
9
from functools import partial
7
10
8
11
from bpython .lazyre import LazyReCompile
9
12
10
13
11
- COLORS = curtsies . termformatconstants . colors + ("default" ,)
14
+ COLORS = CURTSIES_COLORS + ("default" ,)
12
15
CNAMES = dict (zip ("krgybmcwd" , COLORS ))
16
+ # hack for finding the "inverse"
17
+ INVERSE_COLORS = {
18
+ CURTSIES_COLORS [idx ]: CURTSIES_COLORS [
19
+ (idx + (len (CURTSIES_COLORS ) // 2 )) % len (CURTSIES_COLORS )
20
+ ]
21
+ for idx in range (len (CURTSIES_COLORS ))
22
+ }
23
+ INVERSE_COLORS ["default" ] = INVERSE_COLORS [CURTSIES_COLORS [0 ]]
13
24
14
25
15
26
def func_for_letter (l , default = "k" ):
@@ -57,9 +68,7 @@ def fs_from_match(d):
57
68
if d ["bg" ]:
58
69
if d ["bg" ] == "I" :
59
70
# hack for finding the "inverse"
60
- color = COLORS [
61
- (COLORS .index (color ) + (len (COLORS ) // 2 )) % len (COLORS )
62
- ]
71
+ color = INVERSE_COLORS [color ]
63
72
else :
64
73
color = CNAMES [d ["bg" ].lower ()]
65
74
if color != "default" :
You can’t perform that action at this time.
0 commit comments