From 53fca552b8c4406da9bfabf2a6fb05fa14586a5f Mon Sep 17 00:00:00 2001 From: xavi Date: Sat, 5 Oct 2024 22:56:11 -0700 Subject: [PATCH] TODO: Write set_color_of_date function --- src/dodo.c | 5 ++++- src/x_curses.h | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/dodo.c b/src/dodo.c index d6a0322..cef48c2 100644 --- a/src/dodo.c +++ b/src/dodo.c @@ -344,7 +344,6 @@ int bind_sql_insert_stmt(filtered_tasks* task, sqlite3_stmt* out_stmt){ } - // TODO: I think instead of string we should make it a date and then make a string here if ( task->due_date ){ param_pos = 2; rc = sqlite3_bind_text(out_stmt, param_pos, task->due_date, -1, SQLITE_STATIC); @@ -525,6 +524,7 @@ int print_fixed_width(const unsigned char* str, int width){ }else{ printf("%-*.*s", width, width, ""); } + printf("%s", X_RST); } // Print Heading @@ -589,8 +589,11 @@ int display_task_list(int start_col, sqlite3 *db, filtered_tasks* task){ else if ( x_strcmp(col_name, "active_id") == 0 ){ fixed_width = FIXED_ID_WIDTH; } + // TODO: Add colors to due date else if ( x_strcmp(col_name, "due_date") == 0 ){ fixed_width = FIXED_DATE_WIDTH; + set_color_of_date(col_val); + printf("%s", X_GREEN); } print_fixed_width(col_val, fixed_width); } diff --git a/src/x_curses.h b/src/x_curses.h index 525849b..c94065b 100644 --- a/src/x_curses.h +++ b/src/x_curses.h @@ -5,6 +5,8 @@ #define X_BOLD "\x1B[1m" #define X_UNDL "\x1B[21m" #define X_CYN "\x1B[36m" +#define X_GREEN "\x1B[32m" +#define X_RED "\x1B[31m" #define X_goup(y) printf("\x1B[%dF", y) #define X_godown(y) printf("\x1B[%dE", y) #define X_goupnocr(y) printf("\x1B[%dA", y)