mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-06-30 19:12:48 -05:00
Support ESC[38;2;R;G;Bm for 24-bit true colour.
This is a heavily rewritten version of a patch originally by Lorenz Diener; it was tidied up somewhat by Christian Brabandt, and then tidied up more by me. The basic idea is to add to the termchar structure a pair of small structs encoding 24-bit RGB values, each with a flag indicating whether it's turned on; if it is, it overrides any other specification of fg or bg colour for that character cell. I've added a test line to colours.txt containing a few example colours from /usr/share/X11/rgb.txt. In fact it makes quite a good demo to run the whole of rgb.txt through this treatment, with a command such as perl -pe 's!^\s*(\d+)\s+(\d+)\s+(\d+).*$!\e[38;2;$1;$2;$3m$&\e[m!' rgb.txt
This commit is contained in:
28
putty.h
28
putty.h
@ -592,12 +592,36 @@ void prompt_ensure_result_size(prompt_t *pr, int len);
|
||||
/* Burn the evidence. (Assumes _all_ strings want free()ing.) */
|
||||
void free_prompts(prompts_t *p);
|
||||
|
||||
/*
|
||||
* Data type definitions for true-colour terminal display.
|
||||
* 'optionalrgb' describes a single RGB colour, which overrides the
|
||||
* other colour settings if 'enabled' is nonzero, and is ignored
|
||||
* otherwise. 'truecolour' contains a pair of those for foreground and
|
||||
* background.
|
||||
*/
|
||||
typedef struct optionalrgb {
|
||||
unsigned char enabled;
|
||||
unsigned char r, g, b;
|
||||
} optionalrgb;
|
||||
extern const optionalrgb optionalrgb_none;
|
||||
typedef struct truecolour {
|
||||
optionalrgb fg, bg;
|
||||
} truecolour;
|
||||
#define optionalrgb_equal(r1,r2) ( \
|
||||
(r1).enabled==(r2).enabled && \
|
||||
(r1).r==(r2).r && (r1).g==(r2).g && (r1).b==(r2).b)
|
||||
#define truecolour_equal(c1,c2) ( \
|
||||
optionalrgb_equal((c1).fg, (c2).fg) && \
|
||||
optionalrgb_equal((c1).bg, (c2).bg))
|
||||
|
||||
/*
|
||||
* Exports from the front end.
|
||||
*/
|
||||
void request_resize(void *frontend, int, int);
|
||||
void do_text(Context, int, int, wchar_t *, int, unsigned long, int);
|
||||
void do_cursor(Context, int, int, wchar_t *, int, unsigned long, int);
|
||||
void do_text(Context, int, int, wchar_t *, int, unsigned long, int,
|
||||
truecolour);
|
||||
void do_cursor(Context, int, int, wchar_t *, int, unsigned long, int,
|
||||
truecolour);
|
||||
int char_width(Context ctx, int uc);
|
||||
#ifdef OPTIMISE_SCROLL
|
||||
void do_scroll(Context, int, int, int);
|
||||
|
Reference in New Issue
Block a user