Skip to content

Commit 5d2fb8b

Browse files
committed
HiColor Light gruvbox theme
1 parent 1591785 commit 5d2fb8b

File tree

7 files changed

+71
-4
lines changed

7 files changed

+71
-4
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ This pager can be used from `mysql` and `pgcli` clients too.
6464
16. Simple theme
6565
17. Solarized dark theme
6666
18. Solarized light theme
67+
19. Gruvbox light theme
6768

6869
see http://okbob.blogspot.cz/2017/07/i-hope-so-every-who-uses-psql-uses-less.html
6970

src/commands.c

+6
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,8 @@ cmd_string(int cmd)
160160
return "SetTheme_SolarDark";
161161
case cmd_SetTheme_SolarLight:
162162
return "SetTheme_SolarLight";
163+
case cmd_SetTheme_GruvboxLight:
164+
return "SetTheme_GruvboxLight";
163165
case cmd_SaveSetup:
164166
return "SaveSetup";
165167

@@ -411,6 +413,8 @@ theme_get_cmd(int theme)
411413
return cmd_SetTheme_SolarDark;
412414
case 18:
413415
return cmd_SetTheme_SolarLight;
416+
case 19:
417+
return cmd_SetTheme_GruvboxLight;
414418
};
415419

416420
return cmd_Invalid;
@@ -463,6 +467,8 @@ cmd_get_theme(int cmd)
463467
return 17;
464468
case cmd_SetTheme_SolarLight:
465469
return 18;
470+
case cmd_SetTheme_GruvboxLight:
471+
return 19;
466472
};
467473

468474
return 1;

src/commands.h

+1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ typedef enum PspgCommand
6363
cmd_SetTheme_Simple,
6464
cmd_SetTheme_SolarDark,
6565
cmd_SetTheme_SolarLight,
66+
cmd_SetTheme_GruvboxLight,
6667
cmd_SaveSetup,
6768

6869
cmd_Quit,

src/menu.c

+1
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ ST_MENU_ITEM _theme[] = {
9292
{"_s_Simple theme", cmd_SetTheme_Simple},
9393
{"_o_Solar Dark theme", cmd_SetTheme_SolarDark},
9494
{"_g_Solar Light theme", cmd_SetTheme_SolarLight},
95+
{"_u_Gruvbox Light theme", cmd_SetTheme_GruvboxLight},
9596
{NULL},
9697
};
9798

src/pspg.c

+5
Original file line numberDiff line numberDiff line change
@@ -1195,6 +1195,10 @@ refresh_aux_windows(Options *opts, ScrDesc *scrdesc, DataDesc *desc)
11951195
w_bottom_bar(scrdesc) = bottom_bar;
11961196
werase(bottom_bar);
11971197

1198+
/* data colours are better than default */
1199+
wbkgd(bottom_bar, COLOR_PAIR(3));
1200+
wnoutrefresh(bottom_bar);
1201+
11981202
scrdesc->main_maxy = maxy;
11991203
scrdesc->main_maxx = maxx;
12001204
scrdesc->main_start_y = 0;
@@ -2718,6 +2722,7 @@ main(int argc, char *argv[])
27182722
case cmd_SetTheme_Simple:
27192723
case cmd_SetTheme_SolarDark:
27202724
case cmd_SetTheme_SolarLight:
2725+
case cmd_SetTheme_GruvboxLight:
27212726
opts.theme = cmd_get_theme(command);
27222727
reinit = true;
27232728
goto reinit_theme;

src/pspg.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#define LINEINFO_FOUNDSTR_MULTI 4
2525
#define LINEINFO_UNKNOWN 8
2626

27-
#define MAX_STYLE 18
27+
#define MAX_STYLE 19
2828

2929
typedef struct LineInfo
3030
{

src/themes.c

+56-3
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,16 @@ if_notin_int(int v, const int *s, int v1, int v2)
3838
return v1;
3939
}
4040

41+
/* 0..255 rgb based colors */
42+
static void
43+
init_color_rgb_ff(short color, short r, short g, short b)
44+
{
45+
init_color(color,
46+
(r / 255.0) * 1000.0,
47+
(g / 255.0) * 1000.0,
48+
(b / 255.0) * 1000.0);
49+
}
50+
4151
/*
4252
* Set color pairs based on style
4353
*/
@@ -506,6 +516,10 @@ initialize_color_pairs(int theme)
506516
init_color(234, 13, 98, 119);
507517
init_color(235, 18, 141, 172);
508518
init_color(240, 110, 146, 200);
519+
init_color(245, 576, 631, 631);
520+
init_color(244, 557, 616, 624);
521+
init_color(136, 710, 537, 0);
522+
init_color(160, 863, 196, 184);
509523

510524
assume_default_colors(234, 245);
511525

@@ -530,6 +544,45 @@ initialize_color_pairs(int theme)
530544
init_pair(20, 255, 136);
531545
init_pair(21, 235, 244);
532546
break;
547+
548+
case 19:
549+
init_color_rgb_ff(200, 0xff, 0xff, 0xd7); /* background */
550+
init_color_rgb_ff(201, 0x26, 0x26, 0x26); /* foreground */
551+
init_color_rgb_ff(202, 0xaf, 0xaf, 0x87); /* modeline bg */
552+
init_color_rgb_ff(203, 0x4e, 0x4e, 0x4e); /* modeline fg */
553+
init_color_rgb_ff(204, 0xd7, 0xd6, 0xaf); /* table decor */
554+
init_color_rgb_ff(205, 0xeb, 0xdb, 0xb2); /* cursor bg */
555+
init_color_rgb_ff(206, 0xaf, 0xaf, 0xaf); /* footer */
556+
init_color_rgb_ff(207, 0xff, 0xff, 0xaf); /* lineno bg */
557+
558+
init_color_rgb_ff(210, 0x87, 0x00, 0x00); /* keyword - red */
559+
init_color_rgb_ff(211, 0Xd7, 0x5f, 0x5f); /* bookmark - faded red */
560+
init_color_rgb_ff(212, 0x00, 0x5f, 0x87); /* mark - faded blue */
561+
562+
init_color(240, 40, 50, 200);
563+
564+
assume_default_colors(204, 200);
565+
566+
init_pair(2, 203, 202);
567+
init_pair(3, 201, 200);
568+
init_pair(4, 210, 200);
569+
init_pair(5, 210, 205);
570+
init_pair(6, 203, 205);
571+
init_pair(7, 203, 202);
572+
init_pair(8, 17, 200);
573+
init_pair(9, 206, 200);
574+
init_pair(10, 206, 205);
575+
init_pair(11, 204, 205);
576+
init_pair(13, 203, 202);
577+
init_pair(14, COLOR_WHITE, 211);
578+
init_pair(15, 212, 204);
579+
init_pair(16, 201, 204);
580+
init_pair(17, 206, 204);
581+
init_pair(18, -1, -1);
582+
init_pair(19, -1, -1);
583+
init_pair(20, 212, 205);
584+
init_pair(21, 206, 207);
585+
break;
533586
}
534587
}
535588

@@ -550,7 +603,7 @@ initialize_theme(int theme, int window_identifier, bool is_tabular_fmt, bool no_
550603
case WINDOW_LUC:
551604
case WINDOW_FIX_ROWS:
552605
t->data_attr = COLOR_PAIR(4);
553-
t->data_attr |= _notin(theme, (int[]) {12, 15, -1}, A_BOLD, 0);
606+
t->data_attr |= _notin(theme, (int[]) {12, 15, 19, -1}, A_BOLD, 0);
554607
t->data_attr |= _in(theme, (int[]) {15, -1}, A_DIM, 0);
555608
t->data_attr |= _in(theme, (int[]) {16, -1}, A_ITALIC, 0);
556609
break;
@@ -565,7 +618,7 @@ initialize_theme(int theme, int window_identifier, bool is_tabular_fmt, bool no_
565618
t->bottom_attr = COLOR_PAIR(12);
566619
t->bottom_light_attr = COLOR_PAIR(13);
567620

568-
t->prompt_attr |= _notin(theme, (int[]) {0, 1, -1}, A_BOLD, 0);
621+
t->prompt_attr |= _notin(theme, (int[]) {0, 1, 19, -1}, A_BOLD, 0);
569622
t->bottom_attr |= _notin(theme, (int[]) {13, 14, -1}, A_BOLD, 0);
570623
t->bottom_light_attr |= A_BOLD;
571624
break;
@@ -585,7 +638,7 @@ initialize_theme(int theme, int window_identifier, bool is_tabular_fmt, bool no_
585638
t->pattern_data_attr = COLOR_PAIR(16);
586639
t->pattern_line_attr = COLOR_PAIR(17);
587640

588-
t->data_attr |= _notin(theme, (int[]) { 12, 15, -1}, A_BOLD, 0);
641+
t->data_attr |= _notin(theme, (int[]) { 12, 15, 19, -1}, A_BOLD, 0);
589642
t->data_attr |= _in(theme, (int[]) {15, -1}, A_DIM, 0);
590643
t->line_attr |= 0;
591644
t->expi_attr |= A_BOLD;

0 commit comments

Comments
 (0)