Page 1 of 1

Setting Text Color to White Using ANSI.SYS

Posted: Fri Apr 12, 2013 6:43 am
by Tempest
Since DOS decides to set the text color to gray every time it starts, I want to use ANSI.SYS to set it back to, IMHO, a much more readable white color. I've found some way to do this, but unfortunately I can't figure out how to make them work. I think part of the problem may be that I have to use an Escape Key code, which I'm not sure is possible on the PCjr keyboard.

After looking at some websites it appears that I need to enter something like this in my Autoexec.bat file:

prompt $e[0m$p$g
or
prompt $p$g$e[37m


I also found a refence to a code like this:

ESC[1;37;40m


Can anyone help me figure out how to do this? I want to keep the background black and set the text to a nice bright white.

Re: Setting Text Color to White Using ANSI.SYS

Posted: Fri Apr 12, 2013 6:09 pm
by Brutman
You were really close ...

ANSI escape sequences start with the CSI sequence, which is the escape character (ASCII 27) followed by the open bracket. After that you can give parameters and a command. In this case the command is 'm', which is set screen attributes.

Parameters 30 to 37 specify a foreground color. Parameters 40 to 47 specify a background color. 0 is "reset" and 1 is "bold/bright".

Try swapping the order of the escape sequence and the rest of the prompt. It is important to set the color first; subsequent characters will use that.

Re: Setting Text Color to White Using ANSI.SYS

Posted: Fri Apr 12, 2013 6:39 pm
by Tempest
How do I enter the escape character (ASCII 27)? Also, what do you mean by change the order? Can you type out exactly what you mean?

Re: Setting Text Color to White Using ANSI.SYS

Posted: Sat Apr 13, 2013 6:37 am
by Brutman
You don't enter the Esc character directly - you did it as you did with $e.

prompt $e[1;37;40m$p$g should do the trick. I tested this on a VM with DOS 6; it will be the same on a PCjr.