How to restore my terminal emulator colors?

74 views
Skip to first unread message

Steve Litt

unread,
Oct 24, 2023, 8:17:12 AM10/24/23
to Harbour Users
Hi all,

I've been online researching and experimenting to answer this question
for two days, so now I'm asking you. I use Harbour 3.2 on Void Linux
with several terminal emulators including xterm and lxterminal. My
terminal emulators each have a foreground and background color.

When I run a Harbour program, compiled with -gttrm and having @ say and
get commands with a a setcolor() and a cls, upon termination of my
program my terminal emulator is still painted with the colors I was
using in my Harbour program.

According to the documentation, near the beginning of my program I
should have something like:

old_color_string := setcolor(new_color_string)
cls

And one would think that I could restore my terminal emulator's colors
by, at the end, using:

setcolor(old_color_string)

But this doesn't work. The old_color_string variable contains a
colorstring very different from that of the terminal emulator. It's
almost as if the initialization code of my program sets the colorstring
before my first setcolor() can retrieve the existing color string. As a
reminder, I'm compiling with -gttrm .

If worst comes to worst I could wrap my Harbour programs in
shellscripts that call Linux command "clear" on exit of my Harbour
program, but I'm hoping there's something I can do within my Harbour
program to reset the colors of my terminal emulator.

Any ideas?

Thanks,

SteveT

Steve Litt

Autumn 2023 featured book: Rapid Learning for the 21st Century
http://www.troubleshooters.com/rl21
Reply all
Reply to author
Forward
0 new messages