Adding tdukv's addition to the status2d patch - allowing pywal to control the status colours via terminal colors

This commit is contained in:
bakkeby
2020-08-28 07:17:52 +02:00
parent 0d743eddff
commit 82c3984b2d
3 changed files with 69 additions and 0 deletions

View File

@ -1,3 +1,26 @@
#if BAR_STATUS2D_XRDB_TERMCOLORS_PATCH
static char termcol0[] = "#000000"; /* black */
static char termcol1[] = "#ff0000"; /* red */
static char termcol2[] = "#33ff00"; /* green */
static char termcol3[] = "#ff0099"; /* yellow */
static char termcol4[] = "#0066ff"; /* blue */
static char termcol5[] = "#cc00ff"; /* magenta */
static char termcol6[] = "#00ffff"; /* cyan */
static char termcol7[] = "#d0d0d0"; /* white */
static char termcol8[] = "#808080"; /* black */
static char termcol9[] = "#ff0000"; /* red */
static char termcol10[] = "#33ff00"; /* green */
static char termcol11[] = "#ff0099"; /* yellow */
static char termcol12[] = "#0066ff"; /* blue */
static char termcol13[] = "#cc00ff"; /* magenta */
static char termcol14[] = "#00ffff"; /* cyan */
static char termcol15[] = "#ffffff"; /* white */
static char *termcolor[] = {
termcol0, termcol1, termcol2, termcol3, termcol4, termcol5, termcol6, termcol7,
termcol8, termcol9, termcol10, termcol11, termcol12, termcol13, termcol14, termcol15,
};
#endif // BAR_STATUS2D_XRDB_TERMCOLORS_PATCH
int
width_status2d(Bar *bar, BarWidthArg *a)
{
@ -123,6 +146,26 @@ drawstatusbar(int x, char* stext)
drw_clr_create(drw, &drw->scheme[ColBg], buf);
#endif // BAR_ALPHA_PATCH
i += 7;
#if BAR_STATUS2D_XRDB_TERMCOLORS_PATCH
} else if (text[i] == 'C') {
int c = atoi(text + ++i) % 16;
#if BAR_ALPHA_PATCH && BAR_STATUS2D_NO_ALPHA_PATCH
drw_clr_create(drw, &drw->scheme[ColFg], termcolor[c], 0xff);
#elif BAR_ALPHA_PATCH
drw_clr_create(drw, &drw->scheme[ColFg], termcolor[c], alphas[SchemeNorm][ColBg]);
#else
drw_clr_create(drw, &drw->scheme[ColFg], termcolor[c]);
#endif // BAR_ALPHA_PATCH
} else if (text[i] == 'B') {
int c = atoi(text + ++i) % 16;
#if BAR_ALPHA_PATCH && BAR_STATUS2D_NO_ALPHA_PATCH
drw_clr_create(drw, &drw->scheme[ColBg], termcolor[c], 0xff);
#elif BAR_ALPHA_PATCH
drw_clr_create(drw, &drw->scheme[ColBg], termcolor[c], alphas[SchemeNorm][ColBg]);
#else
drw_clr_create(drw, &drw->scheme[ColBg], termcolor[c]);
#endif // BAR_ALPHA_PATCH
#endif // BAR_STATUS2D_XRDB_TERMCOLORS_PATCH
} else if (text[i] == 'd') {
drw->scheme[ColFg] = scheme[SchemeNorm][ColFg];
drw->scheme[ColBg] = scheme[SchemeNorm][ColBg];