[Gambas-user] More colours in gb.ncurses

Tobias Boege taboege at gmail.com
Wed Nov 14 20:51:11 CET 2018


On Wed, 14 Nov 2018, KKing wrote:
> If I go to setup a colour pair in gb.ncurses the color statement only has
> about 8 colours available.
> 
> Is it possible to have more, I'm used to old QuickBasic and PowerBasic
> having more colours, in particular looking for an orange and a brighter
> (higher intensity) white.
> 

Some knowledge of ncurses is needed to use gb.ncurses. You get 16 colors
by combining one of the eight color pairs with the boldness attribute:

  Window.Pen = Color.Yellow
  Window.Print("This is brownish\n\r")
  Window.Print("This is actual yellow\n\r", -1, -1, Attr.Bold)

High-intensity white is similarly "white + bold".

There are terminals which support more colors, like 256 or true color,
but that is not supported by gb.ncurses.

> What is purpose of the Color.Set command, and any example on how to use?
> 

Yes, this allows you to remap a color ID to some other color given by
its RGB triple. You could make Color.Black mean neon green -- I suppose.
The catch is that your terminal has to support that and I have never
used one which does. (gb.)ncurses gives you Color.CanChange as an indicator
of whether your terminal allows you to change the definition of a color.
You should check it before doing Color.Set()s.

You should also check `man init_color` (or comparable resources) for a
general discussion of colors in ncurses.

Regards,
Tobi

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk


More information about the User mailing list