Welcome!

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

SignUp Now!

Some strange behavior after Color command

Jun
149
13
Here's a simplified batch file to demonstrate the issue

Code:
@echo off
echo _FG is %_FG
echo _BG is %_BG
echo Hello
color
echo _FG is %_FG
echo _BG is %_BG
echo There

And here's what shows in the TCC tab

1783719748416.webp


Note that even though my colors are set to bright white on blue, the _FG and _BG variables return White on Black. That seems odd.

But everything works fine unless/until I issue a Color command with no parameters.

Per the help file for COLOR:
"If you do not specify a new foreground and background color, COLOR will revert the display colors to those used when TCC was started (for compatibility with CMD)."

It appears that both the first and second set of echo commands display normally.

But if I run the batch file again, then the first echo commands are displayed with White on Black text, but the second set (after another Color command) are displayed as expected with Bright White on Blue text.

Also, if I run a command from the command line after the batch file ends, the output is displayed with White on Black text.

I think I've set the default text properly in the TCC and TCMD options dialogs, but maybe I missed something. Can anyone else duplicate my results with this simple .BTM file?

I realize this simplified example is trivial, but in the "real" script which ran into this issue, I had a situation where I wanted to use Color command to display some text highlighted as bright Yellow on Blue, and then revert back to the default colors when that was done.


Edit: This is not a V36 issue. There is something not quite right with COLOR running the same batch file in TC Version 35. the _FG and _BG variables are correct there. But the display behaves oddly there too.

1783720715797.webp
 
Not reproducible here, but I don't know how you're setting your colors.

You mentioned setting colors in both the TCC OPTION dialog and the Take Command configuration dialog. That is going to cause trouble - TCC and TCMD will be fighting over who gets to pick the colors. Set colors in one place or the other, not both.

Take Command's color options are intended for apps which don't have any way to colorize themselves. TCC's color options are much more extensive.
 
You mentioned setting colors in both the TCC OPTION dialog and the Take Command configuration dialog. That is going to cause trouble - TCC and TCMD will be fighting over who gets to pick the colors. Set colors in one place or the other, not both.
I was not aware of that Rex. For Version 35, I only had the Take Command colors set, and everything worked as expected.

I think there may still be some issues with the Color command, but let's put that aside for now and go back to my original issue


When I got to Version 36, I set the TCC colors for Output and Input only in the TCC Options Dialog.

1783954438453.webp


When I did that, then after starting TC, the TCC tab displayed like this, with text displayed white on blue, but the rest of the window was black.

1783954503338.webp


Issuing a CLS command set the background color to blue, but I didn't want to have to do that every time. So I poked around and saw that there were new settings in the TC options for CONPTY tabs. So I set the FG Color and BG Color to white on blue there.

1783954749672.webp


That seemed to address my issue since TCC initialized the screen with my selected colors. I didn't realize that would cause other issues.



Looking at my TCMD.ini today, I saw the following entries relating to Colors

Code:
[TakeCommand]
TabPtyFGColor=ffffff
TabPtyBGColor=800000
TabPtyCursorLineFGColor=000000
TabPtyCursorLineBGColor=000000
TabPtySelectedFGColor=000000
TabPtySelectedBGColor=000000

[4NT]
SyntaxColors=No
ColorDir=com exe:bright white on bright blue;btm bat:bright yellow on black;zip rar:bright white on magenta;DIRS:bright yellow
InputColors=Bright Cyan on Blue
StdColors=Bright White on Blue

So I deleted TabPty* entries and restarted Take Command.

Now I am back to having the initial TCC screen display with a black background. And the _FG and _BG variables still show white on black, which doesn't appear to be correct. Could there be something stored somewhere else (Windows registry?) which is causing confusion for TC/TCC?

I noticed one other thing which may or may not be relevant...if I navigate to the TCMD Options and then the Tabs panel, then click OK (without changing anything) the following entries are added back to my TCMD.ini

Code:
[TakeCommand]
TabPtyFGColor=c0c0c0
TabPtyBGColor=000000
TabPtyCursorLineFGColor=000000
TabPtyCursorLineBGColor=000000
TabPtySelectedFGColor=000000
TabPtySelectedBGColor=000000

If you are not able to replicate this Rex, then it could be something in my environment, but I'm not sure where else to look to try to get colors to work as expected.
 
Just tried again with V35.74 and I'm still having issues with my initial TCC colors being set properly.

A couple of potential clues.

If I open a fresh TCMD window and repeat the following command

Code:
echo %_FG on %_BG

_FG and _BG variables are initially displaying Whi on Black, which is not what I set in TCC Options. Once I reach the bottom of the visible screen and scrolling begins, these variables are then set to Bri Whi on Blu, which is what I set in TCC options.


1784131339589.webp



Also, should there be a black band displayed at the bottom of the TCC window, above the status line? It remains there even after the screen starts to scroll.


Further testing shows that any command (e.g. Dir) will change the value of _FG and _BG and begin filling the output lines with a blue background once output reaches the end of the visible window and scrolling begins (on the FrenchE.dll file in the screenshot below).

1784131522299.webp


As I said before, if this isn't reproducible then it's likely my configuration, but I don't know where else to look.
 
Back
Top