mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-07-06 16:26:13 +02:00
Add tag and body color customization options
This commit is contained in:
parent
c63c999bc7
commit
4b934e36eb
4 changed files with 8 additions and 8 deletions
|
@ -106,7 +106,7 @@ class Entry:
|
||||||
return "{title}{sep}{body}\n".format(
|
return "{title}{sep}{body}\n".format(
|
||||||
title=title,
|
title=title,
|
||||||
sep="\n" if has_body else "",
|
sep="\n" if has_body else "",
|
||||||
body=body if has_body else "",
|
body=colorize(body, self.journal.config['colors']['body']) if has_body else "",
|
||||||
)
|
)
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
|
|
|
@ -152,12 +152,12 @@ class Journal(object):
|
||||||
for tag in self.search_tags:
|
for tag in self.search_tags:
|
||||||
tagre = re.compile(re.escape(tag), re.IGNORECASE)
|
tagre = re.compile(re.escape(tag), re.IGNORECASE)
|
||||||
pp = re.sub(tagre,
|
pp = re.sub(tagre,
|
||||||
lambda match: util.colorize(match.group(0), "CYAN"),
|
lambda match: util.colorize(match.group(0), self.config['colors']['tags']),
|
||||||
pp, re.UNICODE)
|
pp, re.UNICODE)
|
||||||
else:
|
else:
|
||||||
pp = re.sub(
|
pp = re.sub(
|
||||||
Entry.Entry.tag_regex(self.config['tagsymbols']),
|
Entry.Entry.tag_regex(self.config['tagsymbols']),
|
||||||
lambda match: util.colorize(match.group(0), "CYAN"),
|
lambda match: util.colorize(match.group(0), self.config['colors']['tags']),
|
||||||
pp
|
pp
|
||||||
)
|
)
|
||||||
return pp
|
return pp
|
||||||
|
|
|
@ -59,8 +59,10 @@ default_config = {
|
||||||
'linewrap': 79,
|
'linewrap': 79,
|
||||||
'indent_character': '|',
|
'indent_character': '|',
|
||||||
'colors': {
|
'colors': {
|
||||||
'date': 'red',
|
'date': 'none',
|
||||||
'title': 'blue',
|
'title': 'none',
|
||||||
|
'body': 'none',
|
||||||
|
'tags': 'none',
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -173,9 +173,7 @@ def verify_config(config):
|
||||||
if upper_color == "NONE":
|
if upper_color == "NONE":
|
||||||
pass
|
pass
|
||||||
if not getattr(colorama.Fore, upper_color, None):
|
if not getattr(colorama.Fore, upper_color, None):
|
||||||
# TODO: Not sure whether both of these should stay or not.
|
print("[{2}ERROR{3}: {0} set to invalid color: {1}]".format(key, color, ERROR_COLOR, RESET_COLOR), file=sys.stderr)
|
||||||
print("[{2}ERROR{3}: {0} set to invalid color: {1}]".format(key, color, ERROR_COLOR, RESET_COLOR))
|
|
||||||
log.error("Invalid color configuration value for '{0}'.".format(key))
|
|
||||||
all_valid_colors = False
|
all_valid_colors = False
|
||||||
return all_valid_colors
|
return all_valid_colors
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue