Change menu_headings to accept color and attribute

Instead of just accepting an attribute, it's now possible to
use a color, or both color and attribute, for example:

OPTIONS=menu_headings:inverse
OPTIONS=menu_headings:red
OPTIONS=menu_headings:red&underline

Default is still just inverse.
This lets the player change the menu heading color without
needing to use menu colors for them.

Also makes it so the core uses NO_COLOR instead of 0, for all
the menu lines which don't have any prefedefined color.

Tested for tty, curses, x11, qt, and win32
This commit is contained in:
Pasi Kallinen
2023-11-13 07:33:48 +02:00
parent dd6c249a8c
commit dd5ca5b058
47 changed files with 251 additions and 150 deletions

View File

@@ -4071,8 +4071,8 @@ Key to jump to the first page in a menu.
Default \(oq\(ha\(cq.
.lp menu_headings
Controls how the headings in a menu are highlighted.
Values are \(lqnone\(rq, \(lqbold\(rq, \(lqdim\(rq, \(lqitalic\(rq,
\(lqunderline\(rq, \(lqblink\(rq, or \(lqinverse\(rq.
Takes a text attribute, or text color and attribute separated by ampersand.
For allowed attributes and colors, see \(lqConfiguring Menu Colors\(rq.
Not all ports can actually display all types.
.lp menu_invert_all
Key to invert all items in a menu.

View File

@@ -4449,9 +4449,8 @@ Implemented by the Amiga, Gem and tty ports.
Default `\verb+^+'.
\item[\ib{menu\verb+_+headings}]
Controls how the headings in a menu are highlighted.
Values are ``{\tt none}'', ``{\tt bold}'', ``{\tt dim}'',
``{\tt italic}'', ``{\tt underline}'',``{\tt blink}'', or
``{\tt inverse}''.
Takes a text attribute, or text color and attribute separated by ampersand.
For allowed attributes and colors, see ``{\it Configuring Menu Colors\/}``.
Not all ports can actually display all types.
\item[\ib{menu\verb+_+invert\verb+_+all}]
Key to invert all items in a menu.

View File

@@ -1282,6 +1282,7 @@ docall naming of the monster that currently has the hero swallowed by
using their visible interior
give missiles thrown or shot by monsters the same chance to get used up upon
hitting as when thrown or shot by the hero
change menu_headings to also accept a color or color&attribute
Fixes to 3.7.0-x General Problems Exposed Via git Repository

View File

@@ -381,20 +381,7 @@ add_menu(windid window, glyphinfo, const anything identifier, char accelerator,
If a window-port does not support all of these, it may map
unsupported attributes to a supported one (e.g. map them
all to ATR_INVERSE).
-- clr color will hold a color value including 24-bit
true color values. To do that, and make it
distinguishable on the windowport side of things, the
windowport needs to treat it as follows:
0 = not used, just ignore the clr value.
1-16 = indicates a normal NetHack color value from
0 - 15, so subtract 1 to get the NetHack
color value.
17... = indicates a 24-bit RGB color value, so
subtract 17 to get the actual 24-bit
color value.
When placing the values into this parameter, the core
will add 1 to a NetHack color value, and add 17 to a
24-bit RGB color value.
-- clr is color and is one of the NetHack CLR_ defines.
-- str is a pointer to the menu item text.
-- itemflags on this item (such as MENU_ITEMFLAGS_SELECTED etc.).