diff --git a/README.md b/README.md index 230ef58..f2a5f42 100644 --- a/README.md +++ b/README.md @@ -246,6 +246,8 @@ PROMPT KEYS: q, ^D, double Enter exit buku ``` +`buku` supports custom colors. Visit the wiki page on how to [customize colors](https://github.com/jarun/Buku/wiki/Customize-colors) for more details. + ### Examples 1. **Edit and add** a bookmark from editor: diff --git a/buku.1 b/buku.1 index b5ad3a4..97012d4 100644 --- a/buku.1 +++ b/buku.1 @@ -347,14 +347,14 @@ index .IP - 2 title .IP - 2 -url +URL .IP - 2 -description +description/comment/note .IP - 2 tag .PD 1 \" Restore paragraph spacing .TP -respectively. The five-letter string is passed is as the argument to the \fB--colors\fR option. +respectively. The five-letter string is passed is as the argument to the \fB--colors\fR option, or as the value of the environment variable \fBBUKU_COLORS\fR. .TP We offer the following colors/styles: .TS @@ -395,9 +395,9 @@ bright cyan index .IP - 2 bold bright green title .IP - 2 -bright yellow url +bright yellow URL .IP - 2 -comments/notes/desc - normal +normal description .IP - 2 bright blue tag .PD 1 \" Restore paragraph spacing diff --git a/buku.py b/buku.py index 52580bc..cca5b92 100755 --- a/buku.py +++ b/buku.py @@ -49,13 +49,12 @@ SKIP_MIMES = {'.pdf', '.txt'} colorize = True # Allow color output by default # Default colour to print records -ID = '\x1b[96m%d. \x1b[0m' -ID_str = ID + '\x1b[1;92m%s\x1b[0;2m [%s]\x1b[0m\n' -ID_DB_str = ID + '\x1b[1;92m%s\x1b[0m' +ID_str = '' +ID_DB_str = '' MUTE_str = '%s \x1b[2m(L)\x1b[0m\n' -URL_str = '%s \x1b[91m>\x1b[93m %s\x1b[0m\n' -DESC_str = '%s \x1b[91m+\x1b[0m %s\x1b[0m\n' -TAG_str = '%s \x1b[91m#\x1b[94m %s\x1b[0m\n' +URL_str = '' +DESC_str = '' +TAG_str = '' # colormap for color output from "googler" project COLORMAP = {k: '\x1b[%sm' % v for k, v in { @@ -3094,6 +3093,7 @@ def main(): tags_in = None desc_in = None pipeargs = [] + colorstr_env = os.getenv('BUKU_COLORS') try: piped_input(sys.argv, pipeargs) @@ -3259,7 +3259,8 @@ POSITIONAL ARGUMENTS: addarg('-p', '--print', nargs='*', help=HIDE) addarg('-f', '--format', type=int, default=0, choices={1, 2, 3, 4}, help=HIDE) addarg('-j', '--json', action='store_true', help=HIDE) - addarg('--colors', dest='colorstr', type=argparser.is_colorstr, metavar='COLORS', help=HIDE) + addarg('--colors', dest='colorstr', type=argparser.is_colorstr, + default=colorstr_env if colorstr_env else 'oKlxm', metavar='COLORS', help=HIDE) addarg('--nc', action='store_true', help=HIDE) addarg('--np', action='store_true', help=HIDE) addarg('-o', '--open', nargs='*', help=HIDE)