delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/06/14/09:45:17

From: "Joe Toth" <jtoth AT megsinet DOT net>
Newsgroups: comp.os.msdos.djgpp
References: <kra15.6974$iy DOT 531598 AT bgtnsc06-news DOT ops DOT worldnet DOT att DOT net>
Subject: Re: dos color ?
Lines: 57
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2919.6600
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600
Message-ID: <YFL15.109$p62.47695@wdc-read-01.qwest.net>
Date: Wed, 14 Jun 2000 08:17:11 -0500
NNTP-Posting-Host: 138.111.168.64
X-Complaints-To: news-admin AT qwestip DOT net
X-Trace: wdc-read-01.qwest.net 960988920 138.111.168.64 (Wed, 14 Jun 2000 07:22:00 MDT)
NNTP-Posting-Date: Wed, 14 Jun 2000 07:22:00 MDT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

"smile773" <smile773 AT bigfoot DOT com> wrote in message
news:kra15.6974$iy DOT 531598 AT bgtnsc06-news DOT ops DOT worldnet DOT att DOT net...
> Could one of you nice persons please share some code
> so that I can change the dos console to blue with white
> letters ?
>
> Could I also change the color of this filename to green
> if it begins with utility for example.
>
> Utility_dos_directory_long_file_names_ver102=lfndos.exe


This is fairly simple


check the <conio.h> header file to find out the enumeration of color names
used.
Also neded is the enumeration of test_modes.

Typically you enable the color mode for the console using

  textmode ( C80 );

and go back to a black & white console by using

  textmode ( BW80 );

Use the 'cprintf(...);' command to perform formatted console output.
the 'printf(...);' command will not output in color for some reason.

The 'putch(.);' command outputs to the console in all cases.

Use the following to set the colors of the characters/backround;

   textattr (   [  BLINK |  ]   <COLORS> <<  4 | <COLORS> );


The  BLINK should make the colors blink or be BOLD.  Which one
is dependent on your system, and I can't say which will occur, if either.

You should only use the 'dark' collors listed in <conio.h> for the first
of the two COLORS listed above. If you specify one of the light colors,
it will be the same as entering the BLINK value.

I don't remember which of the 2 <COLORS> values is the character
and which is the background.  Try what you want and if it is reverse
from what you want, simply reverse the specifications in the code.

You could also try the 'textcolor(.);' and 'textbackground(.)' commands.
I tried them, but the output was still in B&W for me.

Joe Toth




- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019