Skip to content

Commit

Permalink
Improve todo.txt done/date hl color for dark mode, by @gsantner closes
Browse files Browse the repository at this point in the history
  • Loading branch information
gsantner committed Sep 8, 2020
1 parent 37a543e commit f725a85
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Expand Up @@ -38,6 +38,8 @@ protected Editable run(final Editable editable) {
return editable;
}

final boolean isDarkBg = _appSettings.isDarkThemeEnabled();

_profiler.start(true, "Todo.Txt Highlighting");
generalHighlightRun(editable);
_profiler.restart("Paragraph top padding");
Expand Down Expand Up @@ -70,7 +72,7 @@ protected Editable run(final Editable editable) {

// Date: Match Creation date before completition date
_profiler.restart("Date Color");
createColorSpanForMatches(editable, TodoTxtHighlighterPattern.DATE.getPattern(), colors.getDateColor());
createColorSpanForMatches(editable, TodoTxtHighlighterPattern.DATE.getPattern(), colors.getDateColor(isDarkBg));
createColorSpanForMatches(editable, TodoTxtHighlighterPattern.DUE_DATE.getPattern(), colors.getPriorityColor(1), 1);
//createColorSpanForMatches(editable, TodoTxtHighlighterPattern.CREATION_DATE.getPattern(), 0xff00ff00);
//createColorSpanForMatches(editable, TodoTxtHighlighterPattern.COMPLETION_DATE.getPattern(), 0xff0000ff);
Expand All @@ -83,7 +85,7 @@ protected Editable run(final Editable editable) {

// Strike out done tasks (apply no other to-do.txt span format afterwards)
_profiler.restart("Done BgColor");
createColorSpanForMatches(editable, TodoTxtHighlighterPattern.DONE.getPattern(), colors.getDoneColor());
createColorSpanForMatches(editable, TodoTxtHighlighterPattern.DONE.getPattern(), colors.getDoneColor(isDarkBg));
_profiler.restart("done Strike");
createSpanWithStrikeThroughForMatches(editable, TodoTxtHighlighterPattern.DONE.getPattern());

Expand Down
Expand Up @@ -43,12 +43,12 @@ public int getPriorityColor(int priority) {
}
}

public int getDoneColor() {
return 0x993d3d3d;
public int getDoneColor(boolean isDarkBg) {
return isDarkBg ? 0x999d9d9d :0x993d3d3d;
}

public int getDateColor() {
return 0xcc6d6d6d;
public int getDateColor(boolean isDarkBg) {
return isDarkBg ? getDoneColor(isDarkBg) : 0xcc6d6d6d;
}

public int getCategoryColor() {
Expand Down

0 comments on commit f725a85

Please sign in to comment.