diff --git a/README.md b/README.md index cfb577f..370f4d5 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,7 @@ a similar UI. - [x] Add more options in config file - [x] Fix random segfaults - [x] Show more info in the statusbar +- [x] Add color support - [ ] Add bookmarks - [ ] Add ability to run external scripts - [ ] Refactor Code -- [ ] Add color support diff --git a/cf.c b/cf.c index fc14774..b08fe15 100644 --- a/cf.c +++ b/cf.c @@ -40,6 +40,9 @@ int i = 0; // Direcotry to be opened char* dir; +// Name of selected file +char selected_file[128]; + // char array to work with strtok() and for other one time use char temp_dir[250]; @@ -147,6 +150,10 @@ void curses_init() initscr(); noecho(); curs_set(0); + start_color(); + init_pair(1, 2, 0); + init_pair(2, 1, 0); + init_pair(3, 6, 0); } @@ -692,7 +699,13 @@ void init_windows() void displayStatus() { wmove(status_win,1,1); - wprintw(status_win, "(%d/%d)\t%s@%s\t%s", selection+1, len, getenv("USER"), getenv("HOSTNAME"), dir); + wattron(status_win, COLOR_PAIR(2)); + wprintw(status_win, "(%d/%d)", selection+1, len); + wprintw(status_win, "\t%s", dir); + wattroff(status_win, COLOR_PAIR(2)); + wattron(status_win, COLOR_PAIR(3)); + wprintw(status_win, "/%s", selected_file); + wattroff(status_win, COLOR_PAIR(3)); wrefresh(status_win); } @@ -806,9 +819,6 @@ int main(int argc, char* argv[]) // Make the two windows side-by-side and make the status window init_windows(); - // Display Status - displayStatus(); - // Print all the elements and highlight the selection int t = 0; for( i=start; i