Commit 5d867764 authored by Bram Schoenmakers's avatar Bram Schoenmakers

Remove option highlight_projects_colors in favor of colorscheme options.

No need to toggle the highlighting of projects and contexts anymore. If
you want to turn it off, simply assign an empty value to the
project/context colors:

  [colorscheme]
  project_color =
  context_color =
parent 22e61d1f
...@@ -5,7 +5,6 @@ default_command = ls ...@@ -5,7 +5,6 @@ default_command = ls
; filename = todo.txt ; filename = todo.txt
; archive_filename = done.txt ; archive_filename = done.txt
colors = 1 colors = 1
highlight_projects_contexts = 1
identifiers = linenumber ; or: text identifiers = linenumber ; or: text
[ls] [ls]
......
...@@ -44,7 +44,6 @@ class _Config: ...@@ -44,7 +44,6 @@ class _Config:
# topydo # topydo
'default_command': 'ls', 'default_command': 'ls',
'colors': '1', 'colors': '1',
'highlight_projects_contexts': '1',
'filename' : 'todo.txt', 'filename' : 'todo.txt',
'archive_filename' : 'done.txt', 'archive_filename' : 'done.txt',
'identifiers': 'linenumber', 'identifiers': 'linenumber',
...@@ -118,12 +117,6 @@ class _Config: ...@@ -118,12 +117,6 @@ class _Config:
except ValueError: except ValueError:
return self.defaults['colors'] == '1' return self.defaults['colors'] == '1'
def highlight_projects_contexts(self):
try:
return self.cp.getboolean('topydo', 'highlight_projects_contexts')
except ValueError:
return self.defaults['highlight_projects_contexts'] == '1'
def todotxt(self): def todotxt(self):
return os.path.expanduser(self.cp.get('topydo', 'filename')) return os.path.expanduser(self.cp.get('topydo', 'filename'))
......
...@@ -44,10 +44,10 @@ class PrettyPrinterColorFilter(PrettyPrinterFilter): ...@@ -44,10 +44,10 @@ class PrettyPrinterColorFilter(PrettyPrinterFilter):
colorscheme = Colors() colorscheme = Colors()
priority_colors = colorscheme.get_priority_colors() priority_colors = colorscheme.get_priority_colors()
project_color = colorscheme.get_project_color() project_color = colorscheme.get_project_color()
context_color = colorscheme.get_context_color() context_color = colorscheme.get_context_color()
metadata_color = colorscheme.get_metadata_color() metadata_color = colorscheme.get_metadata_color()
link_color = colorscheme.get_link_color() link_color = colorscheme.get_link_color()
if config().colors(): if config().colors():
color = NEUTRAL_COLOR color = NEUTRAL_COLOR
...@@ -56,14 +56,16 @@ class PrettyPrinterColorFilter(PrettyPrinterFilter): ...@@ -56,14 +56,16 @@ class PrettyPrinterColorFilter(PrettyPrinterFilter):
except KeyError: except KeyError:
pass pass
# color by priority
p_todo_str = color + p_todo_str p_todo_str = color + p_todo_str
if config().highlight_projects_contexts():
p_todo_str = re.sub( # color projects / contexts
r'\B(\+|@)(\S*\w)', p_todo_str = re.sub(
lambda m: ( r'\B(\+|@)(\S*\w)',
context_color if m.group(0)[0] == "@" lambda m: (
else project_color) + m.group(0) + color, context_color if m.group(0)[0] == "@"
p_todo_str) else project_color) + m.group(0) + color,
p_todo_str)
# tags # tags
p_todo_str = re.sub(r'\b\S+:[^/\s]\S+\b', p_todo_str = re.sub(r'\b\S+:[^/\s]\S+\b',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment