Welcome!

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

SignUp Now!

ANSI Colors

My misunderstanding goes way back ... to MSDOS, ANSI.SYS, and 4DOS. I may never get it straight.

I don't think DOS had a color model, beyond "There are 16 colors."

Charles, have you any more speculation on why TCMD uses my INI file color palette and not yours?

I haven't messed with it since. Don't really need to redefine colors, I was just curious why that dialog doesn't seem to do anything for me. But... in one of the posts you've since deleted, you suggest that GetConsoleScreenBufferInfoEx() is returning 0 for failure when, in fact, it succeeds. Does that still appear to you to be the case?

I just checked my own code, in one of the few places where I use that function, and I'm not checking the return value. Instead I pass it a buffer filled with zeros, and then check that it has written nonzero values. If there is a bug in GetConsoleScreenBufferInfoEx's return code, I may have avoided it purely by accident.
 
But there was ANSI.SYS which used the VT color sequences (31=red, 32=green, 34=blue)

That was my fault. I had an extra semicolon in there, essentially

Code:
if ( GCSBIEx fails ) ; TCError();

GCSBIEx seems OK. But you can't fill the buffer with ALL zeros. It certainly fails (bad parameter) if you don't initialize the first member with sizeof() (I made that mistake last night too).
 
Today's console (the general audience conhost.exe or openconsole.exe) and WindowsTerminal support 24-bit color and I think TCMD supports only 16 colors. Below are 896 colors (I checked them by reading the screen, plus black) in conhost.exe/TCC ... all at once.
View attachment 3209
Those were made with the escape sequence ESC[38;2;<r>;<g>;<b>m. There are a couple other palettes in the new-fangled console and escape sequences to use them. This is good reading (and not comprehensive).

Once those colors have been displayed, there's no way to retrieve them using the console API functions. They have to be approximated by the colors in the legacy 16-color palette (those can be changed but there's still only 16 of them). So while a custom TCMD palette might work OK (i.e., compared to a console) in some cases, it might not in other cases.

I'll continue, mostly because I have a question.

When the console above is attached by TCMD, the result is dreadful.
View attachment 3210
I suspect that's due to a bug in today's conhost.exe in which ReadConsoleOutputAttribute doesn't work correctly. If I run lotsacolors.btm in the newer OpenConsole.exe, it looks the same as in conhost.exe and it looks better when attached by TCMD.
View attachment 3211
You can see the "approximation" using 16 colors in the righthand 3/4 of that pic. But what's going on in the left 1/4? I'd expect it to be much darker ... even black.
I'd be intereasted in lotsacolors.btm.......
 
Back
Top
[FOX] Ultimate Translator
Translate