From a6f2aba9a42b4c439721668dd37f88f0e7c0b8fc Mon Sep 17 00:00:00 2001 From: dam Date: Wed, 28 Sep 2022 16:40:48 +0000 Subject: Added theme colors to the daily total timers. --- main.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'main.c') 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); -- cgit v1.2.3