aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authordam <dam@gudinoff>2022-09-28 16:40:48 +0000
committerdam <dam@gudinoff>2022-09-28 16:40:48 +0000
commita6f2aba9a42b4c439721668dd37f88f0e7c0b8fc (patch)
treee585a7272ea307ba0fb37d67440d32b068861ed9 /main.c
parent127e4e3fe6377ef5857b790e3f843f8449f1e9d9 (diff)
downloadtask-time-tracker-a6f2aba9a42b4c439721668dd37f88f0e7c0b8fc.tar.zst
task-time-tracker-a6f2aba9a42b4c439721668dd37f88f0e7c0b8fc.zip
Added theme colors to the daily total timers.
Diffstat (limited to 'main.c')
-rw-r--r--main.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/main.c b/main.c
index 6275e90..ee2aa55 100644
--- a/main.c
+++ b/main.c
@@ -888,15 +888,28 @@ void draw_tui(database_t *db, layout_st *layout) {
y = size_y-1;
x = 0 + 1 + layout->columns[L_TITLE_IDX].width;
total_time = 0;
- for (int idx = 0; idx < WEEK_DAYS; idx++) {
+ for (int raw_idx = 0; raw_idx < WEEK_DAYS; raw_idx++) {
+ int idx = adjust_first_day_of_week[raw_idx];
+ int64_t daily_total = db->total_times[idx];
x++;
- int day_idx = (idx + FIRST_DAY_OF_WEEK) % WEEK_DAYS;
- int64_t daily_total = db->total_times[day_idx];
- column_width = layout->columns[day_idx + L_DAYS_IDX].width;
+
+ column_width = layout->columns[L_DAYS_IDX + idx].width;
total_time = add_time(total_time, daily_total);
format_time(string_buffer, daily_total, column_width);
+
+ // Apply theme.
+ if (idx == now_week_day && active_task != NULL) {
+ attron(COLOR_PAIR(THEME_E) | A_BOLD);
+ }
+ else if(idx == now_week_day) {
+ attron(COLOR_PAIR(THEME_D) | A_BOLD);
+ }
+
mvaddstr(y, x, string_buffer);
x += column_width;
+
+ // Reset theme.
+ attrset(A_NORMAL);
}
x++;
format_time(string_buffer, total_time, layout->columns[L_TOTAL_IDX].width);