![]() |
#1 |
Adept
Join Date: Oct 2021
Location: WA
Posts: 206
![]() |
Can get a nice dark brown text color in Zangband, but not in Angband
Was messing with a Curses build of Zangband in an xterm256 Cygwin terminal and noticed that when I compiled it with the colors from a color scheme I'd cooked up in Angband's color editor popped into its src/variable.c color table
Code:
{0x00, 0x00, 0x00, 0x00}, /* TERM_DARK */ {0x00, 0xDD, 0xDC, 0xAD}, /* TERM_WHITE */ {0x00, 0x84, 0x57, 0x2C}, /* TERM_SLATE */ {0x00, 0xFF, 0x80, 0x00}, /* TERM_ORANGE */ {0x00, 0xC0, 0x00, 0x00}, /* TERM_RED */ {0x00, 0x00, 0x80, 0x40}, /* TERM_GREEN */ {0x00, 0x00, 0x40, 0xFF}, /* TERM_BLUE */ {0x00, 0x80, 0x40, 0x00}, /* TERM_UMBER */ {0x00, 0x5E, 0x3D, 0x06}, /* TERM_L_DARK */ {0x00, 0xE7, 0xC3, 0x43}, /* TERM_L_WHITE */ {0x00, 0xFF, 0x00, 0xFF}, /* TERM_VIOLET */ {0x00, 0xFF, 0xFF, 0x00}, /* TERM_YELLOW */ {0x00, 0xFF, 0x40, 0x40}, /* TERM_L_RED */ {0x00, 0x00, 0xFF, 0x00}, /* TERM_L_GREEN */ {0x00, 0x00, 0xD6, 0xDF}, /* TERM_L_BLUE */ {0x00, 0xC0, 0x80, 0x40} /* TERM_L_UMBER */ ![]() they come out in much less saturated browns in Angband ![]() And messing with them in Angband's color editor, I just plain can't get it to give me a nice rich brown color: it jumps between rather icky dark green-brown, or weirdly dark yellow brown, and so forth. There seems to be some kind of severe color rounding-off going on in Angband. I wonder if this is absolutely necessary? Ie, would it be possible to have, in Angband, what appears to be possible in Zangband, namely access to full 24-bit color values, without them being approximated to some much more limited palette instead?
__________________
My roguelike gameplay videos |
![]() |
![]() |
![]() |
#2 |
Vanilla maintainer
Join Date: Apr 2007
Location: Canberra, Australia
Age: 56
Posts: 9,317
Donated: $60
![]() ![]() |
The get_color() function in z-color.c has a comment:
Code:
* TODO: Honour the attribute for the term (full color, mono, 16 color) but * ensure that e.g. the lighter version of yellow becomes white in a 16 color * term, but light yellow in a full colour term. Worth noting also that I know next to nothing about colors ![]()
__________________
One for the Dark Lord on his dark throne In the Land of Mordor where the Shadows lie. |
![]() |
![]() |
![]() |
#3 |
Prophet
Join Date: Apr 2007
Location: Seattle, WA
Posts: 6,666
Donated: $40
![]() |
What nick said. Depending on the screen, i sometimes set TERM_BLUE to royal blue for visibility. Blue on black or vice versa is notoriously hard to perceive.
|
![]() |
![]() |
![]() |
#4 | |
Adept
Join Date: Oct 2021
Location: WA
Posts: 206
![]() |
Quote:
__________________
My roguelike gameplay videos |
|
![]() |
![]() |
![]() |
#5 |
Swordsman
Join Date: Aug 2019
Posts: 273
![]() |
Angband's main-gcu.c isn't using curses' init_color() to override the default color table; Zangband's is. That's likely the main cause.
As a side effect of that, Angband's main-gcu.c is, for the 256 color case, dividing the full range for each color component (0 - 255) into 6 bins but the first and last of those bins cover about one half of the range that the others do. Changing scale_color() to be Code:
static int scale_color(int i, int j, int scale) { return (angband_color_table[i][j] * scale) / 256; } Last edited by backwardsEric; January 23, 2022 at 03:41. Reason: fix typo in Zangband |
![]() |
![]() |
![]() |
#6 |
Adept
Join Date: Oct 2021
Location: WA
Posts: 206
![]() |
(^ Didn't see backwardsEric's reply before I posted this.)
Angband's src/main-gcu.c has this section Code:
static int scale_color(int i, int j, int scale) { return (angband_color_table[i][j] * (scale - 1) + 127) / 255; } static int create_color(int i, int scale) { int r = scale_color(i, 1, scale); int g = scale_color(i, 2, scale); int b = scale_color(i, 3, scale); int rgb = 16 + scale * scale * r + scale * g + b; /* In the case of white and black we need to use the ANSI colors */ if (r == g && g == b) { if (b == 0) rgb = 0; if (b == scale) rgb = 15; } return rgb; } /** * Adjust the color tables if there's more than 16 available. */ static void handle_extended_color_tables(void) { #ifdef A_COLOR if (COLORS == 256 || COLORS == 88) { /* If we have more than 16 colors, find the best matches. These numbers * correspond to xterm/rxvt's builtin color numbers--they do not * correspond to curses' constants OR with curses' color pairs. * * XTerm has 216 (6*6*6) RGB colors, with each RGB setting 0-5. * RXVT has 64 (4*4*4) RGB colors, with each RGB setting 0-3. * * Both also have the basic 16 ANSI colors, plus some extra grayscale * colors which we do not use. */ int i; int scale = COLORS == 256 ? 6 : 4; bg_color = create_color(COLOUR_DARK, scale); for (i = 0; i < BASIC_COLORS; i++) { int fg = create_color(i, scale); int isbold = bold_extended ? A_BRIGHT : A_NORMAL; init_pair(i + 1, fg, bg_color); colortable[i] = COLOR_PAIR(i + 1) | isbold; init_pair(BASIC_COLORS + i, fg, fg); same_colortable[i] = COLOR_PAIR(BASIC_COLORS + i) | isbold; } for (i = 0; i < term_count; ++i) { if (data[i].win) { wbkgdset(data[i].win, ' ' | colortable[COLOUR_DARK]); } } if (data[0].win) { /* * Adjust the background color on the standard screen * as well so separators between the terminals have * the same background as the rest. */ chtype term0_bkg = getbkgd(data[0].win); if (getbkgd(stdscr) != term0_bkg) { wbkgd(stdscr, term0_bkg); wrefresh(stdscr); } } } #endif } Code:
static errr Term_xtra_gcu_react(void) { #ifdef A_COLOR int i; /* Cannot handle color redefinition */ if (!can_fix_color) return (0); /* Set the colors */ for (i = 0; i < 16; i++) { /* Set one color (note scaling) */ init_color(i, angband_color_table[i][1] * 1000 / 255, angband_color_table[i][2] * 1000 / 255, angband_color_table[i][3] * 1000 / 255); } #endif /* Success */ return (0); }
__________________
My roguelike gameplay videos Last edited by smbhax; January 23, 2022 at 03:58. |
![]() |
![]() |
![]() |
#7 | |
Adept
Join Date: Oct 2021
Location: WA
Posts: 206
![]() |
Quote:
__________________
My roguelike gameplay videos Last edited by smbhax; January 23, 2022 at 06:00. |
|
![]() |
![]() |
![]() |
#8 |
Adept
Join Date: Oct 2021
Location: WA
Posts: 206
![]() |
Out of curiosity, I tried swapping the three color-handling sections from Zangband's main-gcu.c into Angband's...which got me Angband reduced to 16 colors, which doesn't work too well with modern Angband. ; ) Ah well.
__________________
My roguelike gameplay videos |
![]() |
![]() |
![]() |
#9 |
Adept
|
Using the Windows version I find that umber text is virtually illegible. I switch it light umber.
|
![]() |
![]() |
![]() |
#10 |
Adept
Join Date: Oct 2021
Location: WA
Posts: 206
![]() |
Yeah recall text doesn't usually use Umber in Vanilla as far as I've seen, so it caught me a bit by surprise in Zangband.
__________________
My roguelike gameplay videos |
![]() |
![]() |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Monster Experience Points Color Too Dark | Egavactip | Vanilla | 0 | October 17, 2020 18:44 |
Adding color rooms to Angband | droof | Vanilla | 63 | April 8, 2020 10:07 |
[Poschengband 7.0.0] Any way to change the text color? | Qyx | Variants | 5 | August 31, 2017 22:43 |
Angband color rooms | t4nk | Development | 3 | December 10, 2016 01:36 |
[npp 0.5.4] text color issue | ghengiz | Development | 17 | March 4, 2012 22:53 |