Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Problem with %_FG and %_BG

May
592
4
I'm trying to save the current colors, change them temporarily, and change them back, using something like this:

Code:
set savecolors=%_fg on %_bg
color  (something else)
(do some stuff)
color %savecolors
This always produces white on black.

Here's a test:
Code:
C:\Tv\TV_DATA\Groton> ver

TCC  12.11.69   Windows XP [Version 5.1.2600]

C:\Tv\TV_DATA\Groton> color bri white on green

C:\Tv\TV_DATA\Groton> echo %_fg on %_bg
Whi on Bla
My workaround for now is that I can restore to standard colors, rather than what was current at the time I save them, with
Code:
set savecolors=%@format[02,%@eval[%@option[StdColors]=h]]
but what I really want is a way to save and restore the current colors.
 
As I understand it, those two variables report the colors at the cursor position. In most cases, they will be white on black -- unless you have filled the screen buffer with something else via e.g. CLS BRI WHI ON GRE.

A variable or variables reporting the color TCC will use for stdout might be useful; but I don't think that's what _FG and _BG do.
 
As I understand it, those two variables report the colors at the cursor position. In most cases, they will be white on black -- unless you have filled the screen buffer with something else via e.g. CLS BRI WHI ON GRE.

A variable or variables reporting the color TCC will use for stdout might be useful; but I don't think that's what _FG and _BG do.

Ah, I see.

Rex, would you consider a way to read out the current values of the foreground and background colors as set by COLOR?
 
Back
Top
[FOX] Ultimate Translator
Translate