How to? Obtain current colors

Apr 18, 2014
237
8
I feel I might be missing something very obvious here, but I can't work out how to find out the current colors, assuming it is possible so to do.

First of all, this is without using ANSI. I can set StdColors in TCMD.INI, then echo %@option[stdcolors] returns that value. So far so good. If I then issue a color command, for example "color bright yellow on black", all subsequent output uses those new colors, but %@option[stdcolors] still returns the value from the INI file.

The internal variables %_fg and %_bg return the colors at the cursor position, but those colors are not necessarily what has been set by the color command.

I've searched the help, but I can't find any variables or functions that can tell me which colors are going to be used the next time something is written to the screen.

Can it be done? Is there are way of finding out the last values that were set by the color command?
 

rconn

Administrator
Staff member
May 14, 2008
11,894
133
There isn't any way to get it in TCC, because there isn't any way to reliably determine it in Windows.

There are several different ways to set the console colors, and all you can be sure of is what is already on the screen, not what is about to be displayed.
 
Apr 18, 2014
237
8
Thank you Rex, I suspected that it might not be possible but wondered if I was overlooking something.