Difference between revisions of "Menucolors"

From NetHackWiki
Jump to navigation Jump to search
m (Text replace - "bilious.homelinux.org" to "bilious.alt.org")
(Uncursed has to be run after cursed, otherwise all uncursed items will be the color assigned to cursed, instead (orange, in this case)..)
Line 23: Line 23:
 
  OPTIONS=color,menucolors
 
  OPTIONS=color,menucolors
 
   
 
   
MENUCOLOR="uncursed"=green
 
 
  MENUCOLOR="blessed"=cyan&bold
 
  MENUCOLOR="blessed"=cyan&bold
 
  MENUCOLOR="cursed"=orange&bold
 
  MENUCOLOR="cursed"=orange&bold
 +
MENUCOLOR="uncursed"=green
 
   
 
   
 
  MENUCOLOR="loadstone\|wand \(of\|called\) cancellation"=underline
 
  MENUCOLOR="loadstone\|wand \(of\|called\) cancellation"=underline

Revision as of 14:54, 7 August 2011

Menucolors
Author Pasi Kallinen
Download link
NetHack PatchDB 11

Menucolors is a patch that allows you to colorize individual rows on a menu based on what regular expressions match its text. The patch was written by paxed and can be found here. You can color the inventory menu, the spellcasting menu, the enhance menu, the options menu, and more. Menucolors are currently only supported in a terminal and (partially) in the Windows GUI.

For example, you could color all blessed items bright cyan, all cursed items bright orange, and all uncursed items dim green. From there you could underline dangerous items (loadstone, wand of cancellation, etc.), make the Amulet of Yendor magenta, all gold yellow, and so on, until you're satisfied.

The menucolors patch also supports globbing instead of regular expressions; the resulting menucolors are far less powerful, but are more portable.

The menucolors are applied top to bottom, and each successive match replaces the colors and attributes. Unfortunately, there's a bug in that setting an attribute (bold, underline, etc) resets the color of a line, and vice versa. You can work around this by setting color&attribute, but that's not a very general solution.

nethack.alt.org has the menucolors patch installed. You can test menucolors out before making the effort of patching it into your source code.

There is a precompiled binary of NetHack 3.4.3 Windows GUI and TTY with menucolors available for download here.

Example

For examples of extensive menucolors, see the .nethackrc files of Eidolos and itsblah. Here's an example nethackrc file that includes menucolors (which uses regular expressions, not globbing):

OPTIONS=color,menucolors

MENUCOLOR="blessed"=cyan&bold
MENUCOLOR="cursed"=orange&bold
MENUCOLOR="uncursed"=green

MENUCOLOR="loadstone\|wand \(of\|called\) cancellation"=underline
MENUCOLOR="Amulet of Yendor named"=magenta                           # color only the real Amulet
MENUCOLOR="gold piece"=yellow

MENUCOLOR="[a-zA-Z] - [a-zA-Z ]+[ ]+[0-9]+\*[ ]+[a-z]+[ ]+[0-9]+%"=magenta  # forgotten spell

and here is an example that uses globbing, that is, only ? and * wildcards.

OPTIONS=color,menucolors

MENUCOLOR="* cursed *"=red
MENUCOLOR="* unholy *"=red
MENUCOLOR="* blessed *"=green
MENUCOLOR="* holy *"=green