mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-20 04:58:32 +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(
|
||||
title=title,
|
||||
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):
|
||||
|
|
|
@ -152,12 +152,12 @@ class Journal(object):
|
|||
for tag in self.search_tags:
|
||||
tagre = re.compile(re.escape(tag), re.IGNORECASE)
|
||||
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)
|
||||
else:
|
||||
pp = re.sub(
|
||||
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
|
||||
)
|
||||
return pp
|
||||
|
|
|
@ -59,8 +59,10 @@ default_config = {
|
|||
'linewrap': 79,
|
||||
'indent_character': '|',
|
||||
'colors': {
|
||||
'date': 'red',
|
||||
'title': 'blue',
|
||||
'date': 'none',
|
||||
'title': 'none',
|
||||
'body': 'none',
|
||||
'tags': 'none',
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
@ -173,9 +173,7 @@ def verify_config(config):
|
|||
if upper_color == "NONE":
|
||||
pass
|
||||
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))
|
||||
log.error("Invalid color configuration value for '{0}'.".format(key))
|
||||
print("[{2}ERROR{3}: {0} set to invalid color: {1}]".format(key, color, ERROR_COLOR, RESET_COLOR), file=sys.stderr)
|
||||
all_valid_colors = False
|
||||
return all_valid_colors
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue