[Gambas-user] More colours in gb.ncurses

Tobias Boege taboege at gmail.com
Wed Nov 14 23:26:58 CET 2018


On Wed, 14 Nov 2018, KKing wrote:
> Tobi,
> 
> many thanks, that helps a bit and I will have to read up on ncurses.
> 
> re Window.Pen, I can see that now, though I'm trying to make the appearance
> of an input field.
> I tried .Paper, but that is the whole screen, whereas I just want the area
> behind the character.
> 

Window.Paper is the background of the whole *Window*, so that behaviour you
got makes sense, yes? You can change the attributes of individual characters
on screen by using the Window class like an array:

  Window[10,5].Background = Color.Cyan ' row 10, column 5

You can also print certain text with specified attributes and color;
see the optional arguments to Window.Print().

But you say you want an input area. In this case you should create a new
window in the space where the input area is supposed to be. The attached
project allocates a one-line window at the bottom of the screen and lets
its foreground to brown. It also implements very minimal line editing
(i.e. the backspace key).

> curiously as well when I tried Window.Paper = Color.Yellow the background
> changed to Blue.
> 

This was actually a bug that I just fixed in 1b66fb3373.

> another odd thing (to me) was when I have no attribute I have Black on
> White, when I use ATTR.BOLD it comes out Grey on White.
> (I'm trying to make the background "brighter" not change the pen colour as
> such.
> 

This is correct: Black + Bold = Light-black = Grey. Welcome to the
wondrous world of terminal colors :-) The boldness operates only on
foreground, no way to make the background lighter, sorry (AFAIK).

> re the set command, is below correct?
>   Color.Set(Color.Cyan, 255, 192, 203)     ' Pink RGB  255-192-203
>   iColPairTest = Pair[Color.Black, Color.Cyan]
> 
> when i used iColPairTest it still came out as Cyan
> 

Does your terminal support color redefinitions, i.e. is Color.CanChange
True? If not, no wonder that it didn't work.

> last one. when I use Window.Locate() it obscures the character that was
> there, which I want to still be visible, is there some way to do that
> (remember I'm have a light colour as a background and text as black)?
> 

You mean your terminal displays a cursor block, maybe blinking, that
overshadows the character? You can get rid of that altogether by
setting

  Screen.Cursor = Cursor.Hidden

[ If you're asking why Screen.Cursor is not a Boolean and what the
  third state of Cursor could be besides Hidden and not-Hidden aka
  Visible, it's "VeryVisible" -- but, as so many things, this might
  or might not have a visible effect, depending on your terminal. ]

Usually though, the character under the cursor should be displayed
in reverse-video, so it should not be invisible. Don't know if you
meant that by "obscured".

Regards,
Tobi

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


More information about the User mailing list