[net.micro.pc] forcing color change from dos

jvz@loral.UUCP (John Van Zandt) (02/13/86)

Having just gotten a color monitor the my IBM-PC/XT, I've decided I
don't like white characters on black background.  How can I have
DOS set the color of my characters on a permanent basis (i.e., every
time I turn the system on)?  I tried doing it in basic, but exiting
basic resets the colors (it appears).

Thanks,
   John Van Zandt
   Loral Instrumentation

megdcs@mb2c.UUCP (Don Sortor) (02/15/86)

> Having just gotten a color monitor the my IBM-PC/XT, I've decided I
> don't like white characters on black background.  How can I have
> DOS set the color of my characters on a permanent basis (i.e., every
> time I turn the system on)?  I tried doing it in basic, but exiting
> basic resets the colors (it appears).
> 
> Thanks,
>    John Van Zandt
>    Loral Instrumentation

Try Norton Utilities.  We use them on our IBM-PC/AT's (I think they
cost about $100.00).  Anyway, one of them is called SA, and you can
set this in your AUTOEXEC.BAT file to control the color of your cursor
each time you boot up.

langet@ecn-pc.UUCP (Timothy Lange) (02/16/86)

I use the DOS PROMPT environment variable to set my screen colors,
example:

PROMPT=$e[0;32;40m$p$g

sets the screen foreground (text) color to blue (or is it green) and the
background color to black.  For more exact info see the DOS manual for
more info on PROMPT and the DOS Tech. manual for ANSI.SYS escape codes
which I use to set screen attributes.
-- 
Tim Lange		Engineering Business Offices
317-494-5338		Rm 120 Engineering Administration Bldg.
Purdue University 	West Lafayette, IN  47907
{decvax|harpo|ihnp4|inuxc|seismo|ucbvax}!pur-ee!langet

john@moncol.UUCP (John Ruschmeyer) (02/17/86)

In article <507@mb2c.UUCP> megdcs@mb2c.UUCP (Don Sortor) writes:
>> Having just gotten a color monitor the my IBM-PC/XT, I've decided I
>> don't like white characters on black background.  How can I have
>> DOS set the color of my characters on a permanent basis (i.e., every
>> time I turn the system on)?  I tried doing it in basic, but exiting
>> basic resets the colors (it appears).
>> 
>
>Try Norton Utilities.  We use them on our IBM-PC/AT's (I think they
>cost about $100.00).  Anyway, one of them is called SA, and you can
>set this in your AUTOEXEC.BAT file to control the color of your cursor
>each time you boot up.

Yes, but don't forget to install ANSI.SYS from your CONFIG.SYS file.

Actually, as long as you've already installed ANSI.SYS, you really don't
need to use the Norton program is you are patient enough to figure out the
right escape sequences.

-- 
Name:		John Ruschmeyer
US Mail:	Monmouth College, W. Long Branch, NJ 07764
Phone:		(201) 571-3451
UUCP:		...!vax135!petsd!moncol!john	...!princeton!moncol!john
						   ...!pesnta!moncol!john

Give an ape control of its environment and it will fill the world with bananas.

jrmb@hou2d.UUCP (J.BONILHA) (02/17/86)

I have a PC/AT ( DOS 3.1  ) and I implemented the following, giving 
yellow foreground and blue background:

I added to CONFIG.SYS the following line :

DEVICE=C:ANSI.SYS ( or the appropriate pathname ; this file comes with
MS DOS )


added to AUTOEXEC.BAT:

TYPE YELLOW.BLU    ( or the appropriate filename )

Created file YELLOW.BLU containing the following escape sequence:

ESC[1;33;44m 

 I used vi to create this file, but a BASIC program would do it, if 
 EDLIN rejects the escape sequence.

More information can be found on the DOS Technical Reference, Chapter 3:
Using Extended Screen and Keyboard Control( section on SET GRAPHICS 
RENDITION - SGR ).

This manual doesn't come with the PC and has to be purchased from IBM 
at a cost of $100 .

halle@hou2b.UUCP (J.HALLE) (02/17/86)

There was a batch program several months ago in PCWORLD which allowed you
to change your foreground and background file via a simple command.  The
program used prompt and escape sequences to do this.  When you find this
program, put the call in your autoexec file and you will be where you
want at powerup, after the diagnostics.

uchuck@ecsvax.UUCP (Charles Bennett) (02/17/86)

> Having just gotten a color monitor the my IBM-PC/XT, I've decided I
> don't like white characters on black background.  How can I have
> DOS set the color of my characters on a permanent basis (i.e., every
> time I turn the system on)?  I tried doing it in basic, but exiting
> basic resets the colors (it appears).
> 
> Thanks,
>    John Van Zandt
>    Loral Instrumentation


Colors, both foreground and background but not border, can be set with
the prompt command.  We set our colors by issuing a prompt string in
the autoexec.bat file.  The info for screen control is given in the
DOS Tech Ref Manual in chapter 3.  In chapter 3, they discuss all
manner of things for screen and key control through escape sequences.
You must have DEVICE=ANSI.SYS in your CONFIG.SYS file for these to work.
Try this on for size:
prompt $e[33;1;44m$e[s$e[1;1f$e[K$e[1;3f$d$e[1;21f$t$e[1;36f$p$e[u$n$g
 
Breakdown: $e[33;1;44m - set color to brown foreground(33)
                                   highlight(1)- now yellow
                                   to blue background(44)
           $e[s - save current cursor position
           $e[1;1f - position cursor at row 1, column 1
           $e[K - erase from cursor to end of line inclusive
           $e[1;3f - position cursor at row 1, column 3
           $d - write day and date
           $e[1;21f - position cursor to row 1, column 21
           $t - write time
           $e[1;36f - position cursor to row 1, column 36
           $p - write current directory of default drive
           $e[u - restore cursor position from saved location
           $n - write default drive letter
           $g - write the > character
 
This string seems long(and indeed it is), but you have at every prompt
in DOS the day, date, time, and what directory(and its path) you are
currently working in. 

If these colors don't agree with you and you don't have access to a
DOS Tech Ref, send email and I will send you the complete color
code list.  Enjoy.
-- 
 
 
                   -Chuck Bennett-
                    919-966-1134
...              ...!(decvax|akgua)!mcnc!ecsvax!uchuck

billw@felix.UUCP (Bill Weinberger) (02/18/86)

In article <1031@loral.UUCP> jvz@loral.UUCP (John Van Zandt) writes:
>Having just gotten a color monitor the my IBM-PC/XT, I've decided I
>don't like white characters on black background.  How can I have
>DOS set the color of my characters on a permanent basis (i.e., every
>time I turn the system on)?  I tried doing it in basic, but exiting
>basic resets the colors (it appears).
>

The most straightforward way that I have found is to use the ANSI.SYS
device driver included with DOS.  The DOS User's Guide (2.0) or DOS
Technical Manual (2.1, etc.) describe the escape sequences you can write
to the con: device to invoke the various display attributes, such as color.
Of course, other programs may have their own ideas about the color, but ANSI
will use and restore your defined colors for talking to DOS and other programs
that write to con:.

Their are 3 major ways to write the escape sequences to con: (choose one):
   1. use the "$e" meta-character in the PROMPT command
   2. edit them into a file and then TYPE or COPY it to con:
   3. write or obtain a program to do it

Hope this helps.
-- 

===============================================================================
Regards, Bill Weinberger                               ucbvax!trwrb!felix!billw
===============================================================================

cramer@kontron.UUCP (Clayton Cramer) (02/19/86)

> Having just gotten a color monitor the my IBM-PC/XT, I've decided I
> don't like white characters on black background.  How can I have
> DOS set the color of my characters on a permanent basis (i.e., every
> time I turn the system on)?  I tried doing it in basic, but exiting
> basic resets the colors (it appears).
> 
> Thanks,
>    John Van Zandt
>    Loral Instrumentation

Use the ANSI.SYS driver that comes with PC-DOS.  (Add the line:

	DEVICE=ANSI.SYS
        
to your CONFIG.SYS file.)  This allows you to add a command to your 
AUTOEXEC.BAT file that does:

	COPY COLORS CON:
        
The COLORS file has a series of codes like:

	ESC[<colorcode>m
        
You can generate this file with either a good editor (as distinguished
from EDLIN) or writing a BASIC program to write the escape character to
the file.

In case you don't have the DOS Technical Reference manual (which used
to be contained within the DOS User's Guide until DOS 2.10), here is
the list of color codes.

	0		(normal)
        1		(bold)
        4		(underscore on monochrome, reverse video on color)
        5		blink
        7		reverse video
        8		invisible
        30		black foreground
        31		red foreground
        32		green foreground
        33		yellow "
        34		blue   "
        35 		magenta "
        36		cyan	"
        37		white   "
        40 - 47		same sequence except background colors

rde@ukc.UUCP (02/19/86)

In article <882@hou2d.UUCP> jrmb@hou2d.UUCP writes:
>I have a PC/AT ( DOS 3.1  ) and I implemented the following, giving 
>yellow foreground and blue background:
>
>I added to CONFIG.SYS the following line :
>
>DEVICE=C:ANSI.SYS ( or the appropriate pathname ; this file comes with
>MS DOS )
>
>
>added to AUTOEXEC.BAT:
>
>TYPE YELLOW.BLU    ( or the appropriate filename )
>
>Created file YELLOW.BLU containing the following escape sequence:
>
>ESC[1;33;44m 
>
> I used vi to create this file, but a BASIC program would do it, if 
> EDLIN rejects the escape sequence.
>
>More information can be found on the DOS Technical Reference, Chapter 3:
>Using Extended Screen and Keyboard Control( section on SET GRAPHICS 
>RENDITION - SGR ).
>
>This manual doesn't come with the PC and has to be purchased from IBM 
>at a cost of $100 .


If you don't want to buy the DOS manual, try looking at a copy of the ANSI
standard for terminals. It includes the colour changing codes as an ISO
extension. Or...(plug plug) buy my book "Intro to PCDOS" which has a lot of
this stuff in appendices and costs a lot less than a DOS manual -)
-- 
           Bob Eager

           rde@ukc.UUCP
           rde@ukc
           ...!mcvax!ukc!rde

           Phone: +44 227 66822 ext 7589