Fix colors implementation
This commit is contained in:
parent
3453369841
commit
c9d15b4c98
@ -393,7 +393,7 @@ PROMPT KEYS:
|
|||||||
buku (? for help) g 4 9-6 << 5 3-2
|
buku (? for help) g 4 9-6 << 5 3-2
|
||||||
37. List bookmarks with **colored output**:
|
37. List bookmarks with **colored output**:
|
||||||
|
|
||||||
$ buku --colors gKlxe -p
|
$ buku --colors oKlxm -p
|
||||||
38. More **help**:
|
38. More **help**:
|
||||||
|
|
||||||
$ buku -h
|
$ buku -h
|
||||||
|
10
buku.1
10
buku.1
@ -388,18 +388,18 @@ Y;bold reverse video
|
|||||||
.TE
|
.TE
|
||||||
.TP
|
.TP
|
||||||
.TP
|
.TP
|
||||||
The default colors string is \fIgKlxe\fR, which stands for
|
The default colors string is \fIoKlxm\fR, which stands for
|
||||||
.IP - 2
|
.IP - 2
|
||||||
cyan index
|
bright cyan index
|
||||||
.PD 0 \" Change paragraph spacing to 0 in the list
|
.PD 0 \" Change paragraph spacing to 0 in the list
|
||||||
.IP - 2
|
.IP - 2
|
||||||
bold bright green title
|
bold bright green title
|
||||||
.IP - 2
|
.IP - 2
|
||||||
yellow url
|
bright yellow url
|
||||||
.IP - 2
|
.IP - 2
|
||||||
comments/notes/desc - normal
|
comments/notes/desc - normal
|
||||||
.IP - 2
|
.IP - 2
|
||||||
blue tag
|
bright blue tag
|
||||||
.PD 1 \" Restore paragraph spacing
|
.PD 1 \" Restore paragraph spacing
|
||||||
.TP
|
.TP
|
||||||
Note that
|
Note that
|
||||||
@ -769,7 +769,7 @@ List bookmarks with \fBcolored output\fR:
|
|||||||
.PP
|
.PP
|
||||||
.EX
|
.EX
|
||||||
.IP
|
.IP
|
||||||
.B $ buku --colors gKlxe -p
|
.B $ buku --colors oKlxm -p
|
||||||
.EE
|
.EE
|
||||||
.PP
|
.PP
|
||||||
|
|
||||||
|
35
buku.py
35
buku.py
@ -49,14 +49,13 @@ SKIP_MIMES = {'.pdf', '.txt'}
|
|||||||
colorize = True # Allow color output by default
|
colorize = True # Allow color output by default
|
||||||
|
|
||||||
# Default colour to print records
|
# Default colour to print records
|
||||||
ID_srch = '\x1b[96m%d. \x1b[0m'
|
ID = '\x1b[96m%d. \x1b[0m'
|
||||||
ID_str = ID_srch + '\x1b[1;92m%s\x1b[0;2m [%s]\x1b[0m\n'
|
ID_str = ID + '\x1b[1;92m%s\x1b[0;2m [%s]\x1b[0m\n'
|
||||||
ID_dbidx = '\x1b[96m%d. \x1b[0m'
|
ID_DB_str = ID + '\x1b[1;92m%s\x1b[0m'
|
||||||
ID_DB_str = ID_dbidx + '\x1b[1;92m%s\x1b[0m'
|
|
||||||
MUTE_str = '%s \x1b[2m(L)\x1b[0m\n'
|
MUTE_str = '%s \x1b[2m(L)\x1b[0m\n'
|
||||||
URL_str = '%s \x1b[91m>\x1b[93m %s\x1b[0m\n'
|
URL_str = '%s \x1b[91m>\x1b[93m %s\x1b[0m\n'
|
||||||
DESC_str = '%s \x1b[91m+\x1b[0m %s\n'
|
DESC_str = '%s \x1b[91m+\x1b[0m %s\x1b[0m\n'
|
||||||
TAG_str = '%s \x1b[91m#\x1b[34m %s\n'
|
TAG_str = '%s \x1b[91m#\x1b[94m %s\x1b[0m\n'
|
||||||
|
|
||||||
# colormap for color output from "googler" project
|
# colormap for color output from "googler" project
|
||||||
COLORMAP = {k: '\x1b[%sm' % v for k, v in {
|
COLORMAP = {k: '\x1b[%sm' % v for k, v in {
|
||||||
@ -68,7 +67,7 @@ COLORMAP = {k: '\x1b[%sm' % v for k, v in {
|
|||||||
'E': '34;1', 'F': '35;1', 'G': '36;1', 'H': '37;1',
|
'E': '34;1', 'F': '35;1', 'G': '36;1', 'H': '37;1',
|
||||||
'I': '90;1', 'J': '91;1', 'K': '92;1', 'L': '93;1',
|
'I': '90;1', 'J': '91;1', 'K': '92;1', 'L': '93;1',
|
||||||
'M': '94;1', 'N': '95;1', 'O': '96;1', 'P': '97;1',
|
'M': '94;1', 'N': '95;1', 'O': '96;1', 'P': '97;1',
|
||||||
'x': '0', 'X': '1', 'y': '7', 'Y': '7;1',
|
'x': '0', 'X': '1', 'y': '7', 'Y': '7;1', 'z': '2',
|
||||||
}.items()}
|
}.items()}
|
||||||
|
|
||||||
# Disguise as Firefox on Ubuntu
|
# Disguise as Firefox on Ubuntu
|
||||||
@ -3306,21 +3305,13 @@ POSITIONAL ARGUMENTS:
|
|||||||
|
|
||||||
# Set colors
|
# Set colors
|
||||||
if args.colorstr:
|
if args.colorstr:
|
||||||
ID_srch = '%d.'
|
ID = setcolors(args.colorstr)[0] + '%d. ' + COLORMAP['x']
|
||||||
ID_str = '%s [%s]\n'
|
ID_DB_dim = COLORMAP['z'] + '[%s]\n' + COLORMAP['x']
|
||||||
ID_dbidx = '%d.'
|
ID_str = ID + setcolors(args.colorstr)[1] + '%s ' + COLORMAP['x'] + ID_DB_dim
|
||||||
ID_DB_str = '%s'
|
ID_DB_str = ID + setcolors(args.colorstr)[1] + '%s' + COLORMAP['x']
|
||||||
MUTE_str = '%s (L)\n'
|
URL_str = COLORMAP['j'] + '%s > ' + setcolors(args.colorstr)[2] + '%s\n' + COLORMAP['x']
|
||||||
URL_str = '%s > %s\n'
|
DESC_str = COLORMAP['j'] + '%s + ' + setcolors(args.colorstr)[3] + '%s\n' + COLORMAP['x']
|
||||||
DESC_str = '%s + %s\n'
|
TAG_str = COLORMAP['j'] + '%s # ' + setcolors(args.colorstr)[4] + '%s\n' + COLORMAP['x']
|
||||||
TAG_str = '%s # %s\n'
|
|
||||||
ID_srch = setcolors(args.colorstr)[0] + ID_srch
|
|
||||||
ID_str = ID_srch + COLORMAP['x'] + setcolors(args.colorstr)[1] + ID_str
|
|
||||||
ID_DB_str = ID_dbidx + COLORMAP['x'] + setcolors(args.colorstr)[1] + ID_DB_str
|
|
||||||
MUTE_str = setcolors(args.colorstr)[3] + MUTE_str
|
|
||||||
URL_str = setcolors(args.colorstr)[2] + URL_str
|
|
||||||
DESC_str = setcolors(args.colorstr)[3] + DESC_str
|
|
||||||
TAG_str = setcolors(args.colorstr)[4] + TAG_str
|
|
||||||
|
|
||||||
# Set up debugging
|
# Set up debugging
|
||||||
if args.debug:
|
if args.debug:
|
||||||
|
Loading…
Reference in New Issue
Block a user