From fcf64daac87ecd5dbeb7387b41ad3f79f05ba9ac Mon Sep 17 00:00:00 2001 From: LemonBoy Date: Mon, 16 Jul 2012 11:56:09 +0200 Subject: [PATCH] Added a way to reset the bg/fg color. --- README.md | 1 + bar.c | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8df8705..0c66f29 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,7 @@ To draw a backslash just backslash escape it (\\\\). ``` f<0-9> Selects the text foreground color from the palette. b<0-9> Selects the text background color from the palette. + To reset the bg/fg color just pass 'r' as color index. l Aligns the text to the left. c Aligns the text to the center. diff --git a/bar.c b/bar.c index fbc9168..e151a4f 100644 --- a/bar.c +++ b/bar.c @@ -67,8 +67,10 @@ parse (char *text) switch (*p++) { case 0x0: return; /* EOL */ case 0xA: return; /* NL */ - case 'f': if (isdigit (*p)) xcb_change_gc (c, gc, XCB_GC_FOREGROUND, (const uint32_t []){ pal[*p-'0'] }); p++; break; - case 'b': if (isdigit (*p)) xcb_change_gc (c, gc, XCB_GC_BACKGROUND, (const uint32_t []){ pal[*p-'0'] }); p++; break; + case 'f': if (*p == 'r') *p = '1'; if (isdigit (*p)) + xcb_change_gc (c, gc, XCB_GC_FOREGROUND, (const uint32_t []){ pal[*p-'0'] }); p++; break; + case 'b': if (*p == 'r') *p = '0'; if (isdigit (*p)) + xcb_change_gc (c, gc, XCB_GC_BACKGROUND, (const uint32_t []){ pal[*p-'0'] }); p++; break; case 'l': align = 0; pos_x = 0; break; case 'c': align = 1; pos_x = 0; break; case 'r': align = 2; pos_x = 0; break;