Add Dracula style (#621)

This introduces a new Dracula color style inspired by the [Dracula theme](https://draculatheme.com).
This commit is contained in:
Rob Loach 2024-04-28 01:02:34 -04:00 committed by GitHub
parent a10a830b0e
commit 7e9da57c09
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 43 additions and 2 deletions

View File

@ -15,7 +15,7 @@ overview(struct nk_context *ctx)
#ifdef INCLUDE_STYLE
/* styles */
static const char* themes[] = {"Black", "White", "Red", "Blue", "Dark"};
static const char* themes[] = {"Black", "White", "Red", "Blue", "Dark", "Dracula"};
static int current_theme = 0;
#endif

View File

@ -1,4 +1,4 @@
enum theme {THEME_BLACK, THEME_WHITE, THEME_RED, THEME_BLUE, THEME_DARK};
enum theme {THEME_BLACK, THEME_WHITE, THEME_RED, THEME_BLUE, THEME_DARK, THEME_DRACULA};
static void
set_style(struct nk_context *ctx, enum theme theme)
@ -124,6 +124,47 @@ set_style(struct nk_context *ctx, enum theme theme)
table[NK_COLOR_SCROLLBAR_CURSOR_ACTIVE] = nk_rgba(58, 93, 121, 255);
table[NK_COLOR_TAB_HEADER] = nk_rgba(48, 83, 111, 255);
nk_style_from_table(ctx, table);
} else if (theme == THEME_DRACULA) {
struct nk_color background = nk_rgba(40, 42, 54, 255);
struct nk_color currentline = nk_rgba(68, 71, 90, 255);
struct nk_color foreground = nk_rgba(248, 248, 242, 255);
struct nk_color comment = nk_rgba(98, 114, 164, 255);
/* struct nk_color cyan = nk_rgba(139, 233, 253, 255); */
/* struct nk_color green = nk_rgba(80, 250, 123, 255); */
/* struct nk_color orange = nk_rgba(255, 184, 108, 255); */
struct nk_color pink = nk_rgba(255, 121, 198, 255);
struct nk_color purple = nk_rgba(189, 147, 249, 255);
/* struct nk_color red = nk_rgba(255, 85, 85, 255); */
/* struct nk_color yellow = nk_rgba(241, 250, 140, 255); */
table[NK_COLOR_TEXT] = foreground;
table[NK_COLOR_WINDOW] = background;
table[NK_COLOR_HEADER] = currentline;
table[NK_COLOR_BORDER] = currentline;
table[NK_COLOR_BUTTON] = currentline;
table[NK_COLOR_BUTTON_HOVER] = comment;
table[NK_COLOR_BUTTON_ACTIVE] = purple;
table[NK_COLOR_TOGGLE] = currentline;
table[NK_COLOR_TOGGLE_HOVER] = comment;
table[NK_COLOR_TOGGLE_CURSOR] = pink;
table[NK_COLOR_SELECT] = currentline;
table[NK_COLOR_SELECT_ACTIVE] = comment;
table[NK_COLOR_SLIDER] = background;
table[NK_COLOR_SLIDER_CURSOR] = currentline;
table[NK_COLOR_SLIDER_CURSOR_HOVER] = comment;
table[NK_COLOR_SLIDER_CURSOR_ACTIVE] = comment;
table[NK_COLOR_PROPERTY] = currentline;
table[NK_COLOR_EDIT] = currentline;
table[NK_COLOR_EDIT_CURSOR] = foreground;
table[NK_COLOR_COMBO] = currentline;
table[NK_COLOR_CHART] = currentline;
table[NK_COLOR_CHART_COLOR] = comment;
table[NK_COLOR_CHART_COLOR_HIGHLIGHT] = purple;
table[NK_COLOR_SCROLLBAR] = background;
table[NK_COLOR_SCROLLBAR_CURSOR] = currentline;
table[NK_COLOR_SCROLLBAR_CURSOR_HOVER] = comment;
table[NK_COLOR_SCROLLBAR_CURSOR_ACTIVE] = purple;
table[NK_COLOR_TAB_HEADER] = currentline;
nk_style_from_table(ctx, table);
} else {
nk_style_default(ctx);
}