How to use bright colors for background

232 views
Skip to first unread message

Steve Litt

unread,
Sep 30, 2023, 3:37:17 AM9/30/23
to Harbour Users
Hi all,

I'm trying to get bright background colors in a command line interface
Harbour program running on a terminal emulator able to have bright
backgrounds, but I'm having no luck getting bright backgrounds in my
Harbour programs.

I have a modern Void Linux system with Harbour version 3.2:

Harbour Make (hbmk2) 3.2.0dev (r2021-04-28 18:02)

The hardware is a 2020 computer with terminal emulators able to have a
bright white background. However,
setcolor("N/W+, W+/N") produced a gray background, not white.
setcolor("BG+/BG+, W+/N") produced light cyan foreground on darker cyan
background.

This is reminiscent of the old 16 color monitors, but I was wondering
if there's a way I could get bright color backgrounds with my
Harbour command line interface programs on my current setup.

Thanks,

SteveT

Steve Litt

Autumn 2023 featured book: Rapid Learning for the 21st Century
http://www.troubleshooters.com/rl21

pete....@gmail.com

unread,
Sep 30, 2023, 5:35:43 AM9/30/23
to Harbour Users
Hi,

try this:
setBlink(.F.)
setColor( "B+/W* )  // bright blue on bright white

Beyond the above traditional color handling, you can do more spectacular color tricks 
utilizing the function hb_gtInfo() but it's a little bit more complicated
(and I don't know whether it is applicable on Linux or not).

regards,
Pete

pete....@gmail.com

unread,
Sep 30, 2023, 5:44:39 AM9/30/23
to Harbour Users

ADDENDUM:
utilizing the function hb_gtInfo() but it's a little bit more complicated
Useful material about this function here:

regards,
Pete

Steve Litt

unread,
Sep 30, 2023, 6:54:07 AM9/30/23
to harbou...@googlegroups.com
Thanks Pete,

I tried
setBlink(.F.)
setColor( "B+/W* ) // bright blue on bright white

but still had a gray background. I put a doublequote after the
asterisk, but still got a gray background. I substituted a plus sign
(+) for the asterisk, but still got a gray background. I tried using
harbour and hbrun instead of compiling to native binary with hbmk2,
still the same result. The following is a "hello world" program I used
in order to demonstrate my inability to get a bright white background:

===================================================
setBlink(.F.)
setColor( "B+/W+" )
CLS
@0,0 say "Hello World!"
===================================================

What am I doing wrong?

Thanks,

SteveT


pete....@gmail.com said on Sat, 30 Sep 2023 02:35:43 -0700 (PDT)

>Hi,
>
>try this:
>setBlink(.F.)
>setColor( "B+/W* ) // bright blue on bright white
>
>Beyond the above traditional color handling, you can do more
>spectacular color tricks
>utilizing the function* hb_gtInfo()* but it's a little bit more
>--
>You received this message because you are subscribed to the Google
>Groups "Harbour Users" group. Unsubscribe:
>harbour-user...@googlegroups.com Web:
>https://groups.google.com/group/harbour-users ---
>You received this message because you are subscribed to the Google
>Groups "Harbour Users" group. To unsubscribe from this group and stop
>receiving emails from it, send an email to
>harbour-user...@googlegroups.com. To view this discussion on
>the web visit
>https://groups.google.com/d/msgid/harbour-users/32262567-61c5-4bc2-ac48-f39969a655a5n%40googlegroups.com.

pete....@gmail.com

unread,
Sep 30, 2023, 7:30:20 AM9/30/23
to Harbour Users
Hi,
- missing double quote after asterisk was my typo (it's needed of course).
- if I'm not mistaken, plus sign (+) in background color has no effect,
  instead the asterisk along with setblink() give the bright background effect
  but this is valid for windows platform, unfortunately I have no much experience 
  with linux platform so the only "hint" i could  offer (guessing) is to try
  to link GTXWC driver:
    hbmk2 yourprg -GTXWC
  and see it helps.

regards,
Pete

Steve Litt

unread,
Sep 30, 2023, 8:04:08 AM9/30/23
to harbou...@googlegroups.com
Thanks Pete,

hbmk2 yourprg -GTXWC didn't compile. Neither did
hbmk2 yourprg -l GTXWC nor hbmk2 yourprg -l gtxwc

hbmk2 yourprg -gtxwc compiled, but didn't turn the background bright.

Does anyone with Harbour/Linux experience know how to get bright
backgrounds?

Thanks,

SteveT


pete....@gmail.com said on Sat, 30 Sep 2023 04:30:20 -0700 (PDT)
>https://groups.google.com/d/msgid/harbour-users/64839158-727d-4c46-95bb-c846c57d6cb7n%40googlegroups.com.

Vitomir Cvitanovic

unread,
Sep 30, 2023, 9:56:29 AM9/30/23
to harbou...@googlegroups.com
SteveT,

For bright background you should use "*", not "+".

So, this should work:

------------------
setBlink(.F.)
//setColor( "B+/W+" )
setColor( "B+/W*" )

CLS
@0,0 say "Hello World!"
--------------------------

(I'm on windows, but it should work on Linux too, if not - it's not Clipper compatible)

Regards,
Vito

Sent from my Xiaomi phone.

Steve Litt

unread,
Sep 30, 2023, 10:10:04 AM9/30/23
to harbou...@googlegroups.com
Thanks Vitomir,

setblink(.f.) and setColor( "B+/W*" ) didn't make a bright white
background either. I'm beginning to suspect that it just doesn't work
under Linux.

Thanks,

SteveT


Vitomir Cvitanovic said on Sat, 30 Sep 2023 15:56:15 +0200
>> https://groups.google.com/d/msgid/harbour-users/20230930065400.697602e6%40mydesk.domain.cxm.
>>
>
>--
>You received this message because you are subscribed to the Google
>Groups "Harbour Users" group. Unsubscribe:
>harbour-user...@googlegroups.com Web:
>https://groups.google.com/group/harbour-users ---
>You received this message because you are subscribed to the Google
>Groups "Harbour Users" group. To unsubscribe from this group and stop
>receiving emails from it, send an email to
>harbour-user...@googlegroups.com. To view this discussion on
>the web visit
>https://groups.google.com/d/msgid/harbour-users/5e2d59d3-1371-4825-8b7e-64c225047e31%40email.android.com.

Damian (DriftZone.pl)

unread,
Sep 30, 2023, 10:27:09 AM9/30/23
to Harbour Users
Hi.
Use numeric color code. For example SetColor("0/15")

Vitomir Cvitanovic

unread,
Sep 30, 2023, 10:43:48 AM9/30/23
to harbou...@googlegroups.com
SteveT,

I'm sorry that didn't work.
Perhaps someone with Linux experience could help.

Regards,
Vito 


Sent from my Xiaomi phone.

jgt

unread,
Sep 30, 2023, 11:11:22 AM9/30/23
to Harbour Users
I tried both ("B+/W+") and ("B+/W*") on my Linuxmint system and got the same blue/gray result.
Then I tried via a convoluted method to a customer Redhat system.  I started a Windows7 virtual box, then connected to the customer VPN, then started a putty session.  The ("B+/W+") produced the same blue./gray, but the "B+/W*" gave the blue/white combination.
Jack

Steve Litt

unread,
Sep 30, 2023, 11:33:01 AM9/30/23
to harbou...@googlegroups.com
Thanks Damian,

setcolor("0/15") produced the same black on gray. Nothing from 8 to 15
produced a bright color in the background.

Thanks,

SteveT


Damian (DriftZone.pl) said on Sat, 30 Sep 2023 07:27:09 -0700 (PDT)
>https://groups.google.com/d/msgid/harbour-users/663c8eae-fdd2-4ff8-ade6-b3ba258ea6c9n%40googlegroups.com.

Steve Litt

unread,
Sep 30, 2023, 11:37:27 AM9/30/23
to harbou...@googlegroups.com
Thanks Jack,

It sounds like you can get bright background colors if you throw
Windows in the mix. That's interesting.

Thanks,

Steve


jgt said on Sat, 30 Sep 2023 08:11:22 -0700 (PDT)
>> https://groups.google.com/d/msgid/harbour-users/20230930100957.3c5de7ac%40mydesk.domain.cxm
>> .
>>
>>
>>
>
>--
>You received this message because you are subscribed to the Google
>Groups "Harbour Users" group. Unsubscribe:
>harbour-user...@googlegroups.com Web:
>https://groups.google.com/group/harbour-users ---
>You received this message because you are subscribed to the Google
>Groups "Harbour Users" group. To unsubscribe from this group and stop
>receiving emails from it, send an email to
>harbour-user...@googlegroups.com. To view this discussion on
>the web visit
>https://groups.google.com/d/msgid/harbour-users/4ce66765-7fe8-4516-b63b-c7afa7a1b444n%40googlegroups.com.

jgt

unread,
Sep 30, 2023, 11:39:29 AM9/30/23
to Harbour Users
The ("B+/W*") also works with both the Windows version of putty via Wine to the local host and the Linux version.

jgt

unread,
Sep 30, 2023, 12:03:52 PM9/30/23
to Harbour Users
I did some more experiments.  Using terminal produced the blue/gray result, but using terminal and then ssh jack@localhost gives the blue/white combination. I also installed the latest version of Putty (vsn 0.79) via flatpak, and it does not give the blue/white.

Damian (DriftZone.pl)

unread,
Sep 30, 2023, 12:28:55 PM9/30/23
to Harbour Users
If you want to get bright background dont use setBlink(.F.)
Compile with -gttrm if you are using console.
In putty use xterm-256color

Your code should look like this:
setColor( "9/15" )
CLS
@0,0 say "Hello World!".
wait
return

It looks like this:

brightwhite.jpg

and this code:

setColor( "9/7" )
CLS
@0,0 say "Hello World!".
wait
return
It looks like this:
white.jpg

Damian (DriftZone.pl)

unread,
Sep 30, 2023, 12:55:35 PM9/30/23
to Harbour Users
On Linux in "text" mode, the GT driver uses the terminal color settings. You can use gttrm and gtsln drivers. Each has its advantages and disadvantages. With the gttrm driver you can change the displayed colors (ANSI mapping) using HB_GTINFO(HB_GTI_PALETTE,XXXXXX)

Always use numeric color codes because from my observations, harbor for Clipper compatibility adopts the rule "An attribute character can occur anywhere in a setting, but is always applied to the foreground color regardless where it occurs."  If numbers are used, this limitation is eliminated

Steve Litt

unread,
Sep 30, 2023, 6:05:52 PM9/30/23
to harbou...@googlegroups.com
Thanks for your solution, Damian, it worked!

I'll write more about it later, but for now the combination of the
following three actions enabled me to set bright color backgrounds:

* Either don't use setblink() or use setblink(.T.)
* hbmk2 mypgm.prg -gttrm
* Use the numeric version of the color strings

Failing to do any one of the three preceding things caused non-bright
background.

Thanks!

SteveT


Damian (DriftZone.pl) said on Sat, 30 Sep 2023 09:28:55 -0700 (PDT)
>https://groups.google.com/d/msgid/harbour-users/55a69dd8-9fd0-46e3-ae2c-2abb8c909695n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages