From 23f1a2ab8a39b5400f665791560cc9584813588b Mon Sep 17 00:00:00 2001 From: night0721 Date: Mon, 1 Jul 2024 02:48:04 +0100 Subject: [PATCH] edit bar to look like catpuccin --- bar.c | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/bar.c b/bar.c index 79d947f..93526d0 100644 --- a/bar.c +++ b/bar.c @@ -10,20 +10,34 @@ extern editor vip; void draw_status_bar(struct abuf *ab) { abAppend(ab, "\x1b[7m", 4); - char status[80], rstatus[80]; - int len = snprintf(status, sizeof(status), "NORMAL | %.20s", + abAppend(ab, "\x1b[1m", 4); + abAppend(ab, "\x1b[38;2;137;180;250m", 19); + + char mode[9] = " NORMAL "; + int mode_len = 8; + abAppend(ab, mode, 8); + + char file[80], lines[80]; + int file_len = snprintf(file, sizeof(file), " %.20s ", vip.filename ? vip.filename : "[No Name]"); - int rlen = snprintf(rstatus, sizeof(rstatus), "%dL | %d:%d", vip.rows, + int lines_len = snprintf(lines, sizeof(lines), "%dL | %d:%d", vip.rows, vip.cy + 1, vip.rx + 1); - if (len > vip.screencols) len = vip.screencols; - abAppend(ab, status, len); - while (len < vip.screencols) { - if (vip.screencols - len == rlen) { - abAppend(ab, rstatus, rlen); + + abAppend(ab, "\x1b[38;2;49;50;68m", 16); + abAppend(ab, "\x1b[22m", 5); + abAppend(ab, "\x1b[48;2;137;180;250m", 19); + abAppend(ab, file, file_len); + abAppend(ab, "\x1b[38;2;0;0;0m", 13); + + + while (file_len < vip.screencols) { + if (vip.screencols - mode_len - file_len == lines_len) { + abAppend(ab, "\x1b[48;2;255;255;255m", 19); + abAppend(ab, lines, lines_len); break; } else { abAppend(ab, " ", 1); - len++; + file_len++; } } abAppend(ab, "\x1b[m", 3);