c++ - 256 bit image mask for xterm-256 -


i using ncurses c++ on xterm-256 display , print text in shades of red, i'm having trouble finding simple way this.

using this chart can see 0x009 red , 0x255 - 0x232 various shades of black. how can go using information form mast colors?

i form map such 10 means white , 20 means red, such 15 pink , on. create color pairs with

init_pair(10, ???, color_black); init_pair(11, ???, color_black); ... init_pair(20, ???, color_black); 

so use these colors later shade white red.

it depends on assumptions want make. layout of xterm 256color feature given, 3 parts:

  1. colors 0-15 ansi colors , bright versions of those.
  2. colors 16-231 6x6x6 color cube
  3. colors 232-255 grayscale ramp, intentionally leaving out black , white

see example 256color.pl (widely copied xterm sources). numbers make more sense the chart when see picture:

enter image description here

you refer color numbers in init_pair. bright red have noticed 9 (color_red + 8).

on other hand, color palette can modified. use init_color (giving own red/green/blue triple) define color number, , use that in init_pair.