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
21import re
32
43from 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+ )
69from functools import partial
710
811from bpython .lazyre import LazyReCompile
912
1013
11- COLORS = curtsies . termformatconstants . colors + ("default" ,)
14+ COLORS = CURTSIES_COLORS + ("default" ,)
1215CNAMES = 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 ]]
1324
1425
1526def func_for_letter (l , default = "k" ):
@@ -57,9 +68,7 @@ def fs_from_match(d):
5768 if d ["bg" ]:
5869 if d ["bg" ] == "I" :
5970 # hack for finding the "inverse"
60- color = COLORS [
61- (COLORS .index (color ) + (len (COLORS ) // 2 )) % len (COLORS )
62- ]
71+ color = INVERSE_COLORS [color ]
6372 else :
6473 color = CNAMES [d ["bg" ].lower ()]
6574 if color != "default" :
You can’t perform that action at this time.
0 commit comments