Skip to content

Commit 76537e1

Browse files
authored
configuration: move hardcoded colors into default.theme (#4124)
1 parent bb815a8 commit 76537e1

4 files changed

Lines changed: 95 additions & 76 deletions

File tree

doc/man/taskrc.5.in

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,10 @@ statement:
156156
By using include files you can divide your main configuration file into several
157157
ones containing just the relevant configuration data like colors, etc.
158158

159-
There are two excellent uses of includes in your .taskrc, shown here:
159+
There are three excellent uses of includes in your .taskrc, shown here:
160160

161161
.nf
162+
include default.theme
162163
include holidays.en-US.rc
163164
include dark-16.theme
164165
.fi
@@ -813,9 +814,8 @@ terminal, can be obtained by running the command:
813814
.RE
814815

815816
.RS
816-
Note that no default values are listed here - the defaults now correspond to the
817-
dark-256.theme (Linux) and dark-16.theme (other) theme values.
818-
The coloration rules are as follows:
817+
The defaults now correspond to the settings defined in default.theme.
818+
The basic coloration rules parsed through this modular setup are as follows:
819819
.RE
820820

821821
.RS

doc/rc/default.theme

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Color controls.
2+
color=1 # Enable color
3+
4+
# Here is the rule precedence order, highest to lowest.
5+
# Note that these are just the color rule names, without the leading 'color.'
6+
# and any trailing '.value'.
7+
rule.precedence.color=deleted,completed,active,keyword.,tag.,project.,overdue,scheduled,due.today,due,blocked,blocking,recurring,tagged,uda.
8+
9+
# General decoration
10+
rule.color.merge=1
11+
color.label=
12+
color.label.sort=
13+
color.alternate=on gray2
14+
color.header=color3
15+
color.footnote=color3
16+
color.warning=bold red
17+
color.error=white on red
18+
color.debug=color4
19+
20+
# Task state
21+
color.completed=
22+
color.deleted=
23+
color.active=rgb555 on rgb410
24+
color.recurring=rgb013
25+
color.scheduled=on rgb001
26+
color.until=
27+
color.blocked=white on color8
28+
color.blocking=black on color15
29+
30+
# Project
31+
color.project.none=
32+
33+
# Priority UDA
34+
color.uda.priority.H=color255
35+
color.uda.priority.L=color245
36+
color.uda.priority.M=color250
37+
38+
# Tags
39+
color.tag.next=rgb440
40+
color.tag.none=
41+
color.tagged=rgb031
42+
43+
# Due
44+
color.due.today=rgb400
45+
color.due=color1
46+
color.overdue=color9
47+
48+
# Report: burndown
49+
color.burndown.done=on rgb010
50+
color.burndown.pending=on color9
51+
color.burndown.started=on color11
52+
53+
# Report: history
54+
color.history.add=color0 on rgb500
55+
color.history.delete=color0 on rgb550
56+
color.history.done=color0 on rgb050
57+
58+
# Report: summary
59+
color.summary.background=white on color0
60+
color.summary.bar=black on rgb141
61+
62+
# Command: calendar
63+
color.calendar.due.today=color15 on color1
64+
color.calendar.due=color0 on color1
65+
color.calendar.holiday=color0 on color11
66+
color.calendar.scheduled=rgb013 on color15
67+
color.calendar.overdue=color0 on color9
68+
color.calendar.today=color15 on rgb013
69+
color.calendar.weekend=on color235
70+
color.calendar.weeknumber=rgb013
71+
72+
# Command: sync
73+
color.sync.added=rgb010
74+
color.sync.changed=color11
75+
color.sync.rejected=color9
76+
77+
# Command: undo
78+
color.undo.after=color2
79+
color.undo.before=color1

src/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,8 @@ set_property (TARGET lex_executable PROPERTY OUTPUT_NAME "lex")
7373
#SET(CMAKE_CXX_FLAGS_GCOV "--coverage")
7474
#SET(CMAKE_C_FLAGS_GCOV "--coverage")
7575
#SET(CMAKE_EXE_LINKER_FLAGS_GCOV "--coverage")
76+
if (CMAKE_BUILD_TYPE STREQUAL "Debug" OR NOT CMAKE_BUILD_TYPE)
77+
target_compile_definitions(task PRIVATE
78+
-DTASK_TEST_RCDIR="${CMAKE_SOURCE_DIR}/doc/rc"
79+
)
80+
endif ()

src/Context.cpp

Lines changed: 7 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -197,85 +197,19 @@ std::string configurationDefaults =
197197
"\n"
198198
"# Color controls.\n"
199199
"color=1 # Enable color\n"
200+
#ifdef TASK_TEST_RCDIR
201+
"include " TASK_TEST_RCDIR
202+
"/default.theme\n"
203+
#else
204+
"include default.theme\n"
205+
#endif
200206
"\n"
201207
"# Here is the rule precedence order, highest to lowest.\n"
202208
"# Note that these are just the color rule names, without the leading 'color.'\n"
203209
"# and any trailing '.value'.\n"
204210
"rule.precedence.color=deleted,completed,active,keyword.,tag.,project.,overdue,scheduled,due."
205211
"today,due,blocked,blocking,recurring,tagged,uda.\n"
206212
"\n"
207-
"# General decoration\n"
208-
"rule.color.merge=1\n"
209-
"color.label=\n"
210-
"color.label.sort=\n"
211-
"color.alternate=on gray2\n"
212-
"color.header=color3\n"
213-
"color.footnote=color3\n"
214-
"color.warning=bold red\n"
215-
"color.error=white on red\n"
216-
"color.debug=color4\n"
217-
"\n"
218-
"# Task state\n"
219-
"color.completed=\n"
220-
"color.deleted=\n"
221-
"color.active=rgb555 on rgb410\n"
222-
"color.recurring=rgb013\n"
223-
"color.scheduled=on rgb001\n"
224-
"color.until=\n"
225-
"color.blocked=white on color8\n"
226-
"color.blocking=black on color15\n"
227-
"\n"
228-
"# Project\n"
229-
"color.project.none=\n"
230-
"\n"
231-
"# Priority UDA\n"
232-
"color.uda.priority.H=color255\n"
233-
"color.uda.priority.L=color245\n"
234-
"color.uda.priority.M=color250\n"
235-
"\n"
236-
"# Tags\n"
237-
"color.tag.next=rgb440\n"
238-
"color.tag.none=\n"
239-
"color.tagged=rgb031\n"
240-
"\n"
241-
"# Due\n"
242-
"color.due.today=rgb400\n"
243-
"color.due=color1\n"
244-
"color.overdue=color9\n"
245-
"\n"
246-
"# Report: burndown\n"
247-
"color.burndown.done=on rgb010\n"
248-
"color.burndown.pending=on color9\n"
249-
"color.burndown.started=on color11\n"
250-
"\n"
251-
"# Report: history\n"
252-
"color.history.add=color0 on rgb500\n"
253-
"color.history.delete=color0 on rgb550\n"
254-
"color.history.done=color0 on rgb050\n"
255-
"\n"
256-
"# Report: summary\n"
257-
"color.summary.background=white on color0\n"
258-
"color.summary.bar=black on rgb141\n"
259-
"\n"
260-
"# Command: calendar\n"
261-
"color.calendar.due.today=color15 on color1\n"
262-
"color.calendar.due=color0 on color1\n"
263-
"color.calendar.holiday=color0 on color11\n"
264-
"color.calendar.scheduled=rgb013 on color15\n"
265-
"color.calendar.overdue=color0 on color9\n"
266-
"color.calendar.today=color15 on rgb013\n"
267-
"color.calendar.weekend=on color235\n"
268-
"color.calendar.weeknumber=rgb013\n"
269-
"\n"
270-
"# Command: sync\n"
271-
"color.sync.added=rgb010\n"
272-
"color.sync.changed=color11\n"
273-
"color.sync.rejected=color9\n"
274-
"\n"
275-
"# Command: undo\n"
276-
"color.undo.after=color2\n"
277-
"color.undo.before=color1\n"
278-
"\n"
279213
"# UDA priority\n"
280214
"uda.priority.type=string # UDA priority is a string type\n"
281215
"uda.priority.label=Priority # UDA priority has a display label'\n"
@@ -1197,6 +1131,7 @@ void Context::createDefaultConfig() {
11971131
<< "\n#data.location=~/.local/share/task\n"
11981132
<< "#hooks.location=~/.config/task/hooks\n"
11991133
<< "\n# Color theme (uncomment one to use)\n"
1134+
<< "include default.theme\n"
12001135
<< "#include light-16.theme\n"
12011136
<< "#include light-256.theme\n"
12021137
<< "#include bubblegum-256.theme\n"

0 commit comments

Comments
 (0)