Pass base-256 colour index to curses_putch
And to its inner function write_char
This commit is contained in:
+2
-1
@@ -886,7 +886,8 @@ static struct {
|
||||
int index;
|
||||
uint32 value;
|
||||
} color_256_definitions[] = {
|
||||
/* color values are from unnethack */
|
||||
/* from unnethack - these are the colors used by xterm
|
||||
when $TERM is set to xterm-256color */
|
||||
{ 16, 0x000000 }, { 17, 0x00005f }, { 18, 0x000087 },
|
||||
{ 19, 0x0000af }, { 20, 0x0000d7 }, { 21, 0x0000ff },
|
||||
{ 22, 0x005f00 }, { 23, 0x005f5f }, { 24, 0x005f87 },
|
||||
|
||||
@@ -941,14 +941,14 @@ curses_print_glyph(
|
||||
int glyph;
|
||||
int ch;
|
||||
struct glyph_attributes attr;
|
||||
int nhcolor = 0;
|
||||
unsigned int special;
|
||||
|
||||
attr.attribute_flags = -1;
|
||||
glyph = glyphinfo->glyph;
|
||||
special = glyphinfo->gm.glyphflags;
|
||||
ch = glyphinfo->ttychar;
|
||||
attr.color = glyphinfo->gm.sym.color;
|
||||
attr.basic_color = glyphinfo->gm.sym.color;
|
||||
attr.color256 = 0;
|
||||
attr.framecolor = bkglyphinfo->framecolor;
|
||||
/* Extra color handling
|
||||
* FIQ: The curses library does not support truecolor, only the more limited 256
|
||||
@@ -958,12 +958,10 @@ curses_print_glyph(
|
||||
if (glyphinfo->gm.customcolor != 0
|
||||
&& (curses_procs.wincap2 & WC2_EXTRACOLORS) != 0) {
|
||||
if ((glyphinfo->gm.customcolor & NH_BASIC_COLOR) != 0) {
|
||||
attr.color = COLORVAL(glyphinfo->gm.customcolor);
|
||||
#if 0
|
||||
attr.basic_color = COLORVAL(glyphinfo->gm.customcolor);
|
||||
} else {
|
||||
/* 24-bit color, NH_BASIC_COLOR == 0 */
|
||||
nhcolor = COLORVAL(glyphinfo->gm.customcolor);
|
||||
#endif
|
||||
attr.color256 = glyphinfo->gm.color256idx;
|
||||
}
|
||||
}
|
||||
if ((special & MG_PET) && iflags.hilite_pet) {
|
||||
|
||||
@@ -40,7 +40,8 @@ typedef struct nhwd {
|
||||
|
||||
typedef struct nhchar {
|
||||
int ch; /* character */
|
||||
int color; /* color info for character */
|
||||
int color; /* basic color info for character */
|
||||
int color256; /* extended color for the character, 0 if none */
|
||||
int framecolor; /* background color info for character */
|
||||
int attr; /* attributes of character */
|
||||
struct unicode_representation *unicode_representation;
|
||||
@@ -554,7 +555,8 @@ curses_putch(winid wid, int x, int y, int ch,
|
||||
|
||||
--x; /* map column [0] is not used; draw column [1] in first screen col */
|
||||
map[y][x].ch = ch;
|
||||
map[y][x].color = attr->color;
|
||||
map[y][x].color = attr->basic_color;
|
||||
map[y][x].color256 = attr->color256;
|
||||
map[y][x].framecolor = attr->framecolor;
|
||||
map[y][x].attr = attr->attribute_flags;
|
||||
#ifdef ENHANCED_SYMBOLS
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
# define CURSWIN_H
|
||||
|
||||
struct glyph_attributes {
|
||||
int color;
|
||||
int basic_color; // basic color
|
||||
int color256; // extended color (0 if not defined), used when supported
|
||||
int framecolor;
|
||||
int attribute_flags;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user