Add nicer dark and light colour sets (themes) used on terminals with 256

or more colours. Currently based these on emacs but they could change.
Terminals with fewer colours use the ANSI colours. A new "theme" option
overrides the detected theme (set to "terminal" to go back to ANSI
colours).
This commit is contained in:
nicm
2026-06-25 23:17:25 +00:00
parent 2d0845860a
commit 8c55a388cd
8 changed files with 478 additions and 29 deletions

21
tmux.h
View File

@@ -728,10 +728,26 @@ enum hanguljamo_state {
/* Colour flags. */
#define COLOUR_FLAG_256 0x01000000
#define COLOUR_FLAG_RGB 0x02000000
#define COLOUR_FLAG_THEME 0x04000000
/* Special colours. */
#define COLOUR_DEFAULT(c) ((c) == 8 || (c) == 9)
/* Theme colours. */
enum colour_theme {
COLOUR_THEME_BLACK,
COLOUR_THEME_WHITE,
COLOUR_THEME_LIGHT_GREY,
COLOUR_THEME_DARK_GREY,
COLOUR_THEME_GREEN,
COLOUR_THEME_YELLOW,
COLOUR_THEME_RED,
COLOUR_THEME_BLUE,
COLOUR_THEME_CYAN,
COLOUR_THEME_MAGENTA
};
#define COLOUR_THEME_COUNT 10
/* Replacement palette. */
struct colour_palette {
int fg;
@@ -2219,6 +2235,8 @@ struct client {
int references;
int theme_colours[COLOUR_THEME_COUNT];
void *pan_window;
u_int pan_ox;
u_int pan_oy;
@@ -3113,6 +3131,7 @@ void server_client_print(struct client *, int, struct evbuffer *);
/* server-fn.c */
void server_redraw_client(struct client *);
void server_client_update_theme_colours(struct client *);
void server_status_client(struct client *);
void server_redraw_session(struct session *);
void server_redraw_session_group(struct session *);
@@ -3226,6 +3245,8 @@ int colour_dim(int, u_int);
const char *colour_tostring(int);
enum client_theme colour_totheme(int);
int colour_fromstring(const char *);
const char *colour_theme_option(u_int, enum client_theme);
int colour_theme_terminal_colour(u_int);
int colour_256toRGB(int);
int colour_256to16(int);
int colour_byname(const char *);