diff --git a/src/coloratt.c b/src/coloratt.c index 10f216ba6..a5d040fda 100644 --- a/src/coloratt.c +++ b/src/coloratt.c @@ -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 }, diff --git a/win/curses/cursmain.c b/win/curses/cursmain.c index 3966771f6..f6b5e3013 100644 --- a/win/curses/cursmain.c +++ b/win/curses/cursmain.c @@ -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) { diff --git a/win/curses/curswins.c b/win/curses/curswins.c index ee28d4508..6ce123c34 100644 --- a/win/curses/curswins.c +++ b/win/curses/curswins.c @@ -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 diff --git a/win/curses/curswins.h b/win/curses/curswins.h index 992fea55a..13985ce1b 100644 --- a/win/curses/curswins.h +++ b/win/curses/curswins.h @@ -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; };