www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Colors in console

reply "Lionello Lunesu" <lionello.lunesu crystalinter.remove.com> writes:
Is there any way to print text in different colors in the console?
ANSI escape sequences have no effect. Do I have to use the Win32 console API 
directly?

(Will there ever be ANSI support in Phobos' writef, or a std.console with 
wrappers for different platforms? Or, uh, should I create a GUI instead 
:-S....)

Lionello.

-- Get the CACert root certificate (and a personal one) at 
http://cacert.org/ 
Nov 30 2004
next sibling parent reply Stewart Gordon <smjg_1998 yahoo.com> writes:
Lionello Lunesu wrote:
 Is there any way to print text in different colors in the console?
 ANSI escape sequences have no effect. 
Yes, these always required the ANSI.SYS driver to be loaded. AIUI this was set up in most MS-DOS installations before Windows 95 came along.
 Do I have to use the Win32 console API directly?
<snip> No. In the dmc package, there's a disp.h file with functions to do things like this. You can turn it into a D module and then use it. Stewart. -- My e-mail is valid but not my primary mailbox. Please keep replies on the 'group where everyone may benefit.
Dec 01 2004
parent "Lionello Lunesu" <lionello.lunesu crystalinter.remove.com> writes:
 No.  In the dmc package, there's a disp.h file with functions to do
 things like this.  You can turn it into a D module and then use it.
Wauw! Thanks a lot, that did the trick. I've attached the converted header-file to this message. Please, anyone, let me know if this is inappropriate. Lionello. begin 666 disp.zip M \1_&.GZP: <F.3:I$'5*2'T#I60BC2]5J=39.P!K&R\UN[RIHK_?KO>M;'7 M8%I',>SXF=G9F=GQTFE!G\9;%LX7`IQ^$[KOK][]?NZZ79ANX2Z<A\(C<.\Q MWH8W$UR%/*31-73;R1^\ 5:G46_4<2.018D!""/1J-< "'G\'"U?&5WSL[S M2JC_$M,75/!9_G^9WJ2[]O<*JS3&R*EX+AWC) H5U)1NG)(C^UN%ID\HUZ%; M(5.UX_P31H$LB6:C_N.HUI+C-*0\T=L=I5[I*HM3A0LSLN2+JA 4G+B>5SU MW2(,4&>ULD 6='V$,N'8AWB=WQN-NFR5?Q$Z]0B'F>R0P]M[^-Q/&R<'AZ$7 MOR:WA&.I5M34QAJ7;Y^MGRQJISSW:<1%,MO=\/'S\V3P=3!Y''P=W T>0%\? MW,VEVRN1XX?)_<T(\I<DW<LR^32^&TQ&P_& 2'8/V1RKS]'-]P+I] YX.AQ_ M#T1$ W_?C#Y M_U[\9\2ZMYECGUIMXE4D8P3/:L5:H-:<OA5,8ZF9L"145XY_I,O)MGPML:75 M*8*IM&0UP$-6`[1 76(VJ*46BLG<-HJEN77QV9R66JBJHK))73!M4T]M!37J M^N?3KM-1OU .;_M&_7]02P$"% `4``(`" #P K```````!`" `````````9&ES<"YD4$L%! `````!``$`- ```!D$```````` ` end
Dec 01 2004
prev sibling parent David L. Davis <SpottedTiger yahoo.com> writes:
In article <cojsi1$19ct$1 digitaldaemon.com>, Lionello Lunesu says...
Is there any way to print text in different colors in the console?
ANSI escape sequences have no effect. Do I have to use the Win32 console API 
directly?

(Will there ever be ANSI support in Phobos' writef, or a std.console with 
wrappers for different platforms? Or, uh, should I create a GUI instead 
:-S....)

Lionello.

-- Get the CACert root certificate (and a personal one) at 
http://cacert.org/ 
Lionello: For an example that uses Win32 APIs, please follow the link to my D web site page at http://spottedtiger.tripod.com/D_Language/D_Hub_Adv_Tutor_XP.html and grab WinCon01aug04.zip which includes an example file called rainbow.d that does 16 colors foreground and 16 colors background (256 combinations). I think this is what you're looking for. David L. ------------------------------------------------------------------- "Dare to reach for the Stars...Dare to Dream, Build, and Achieve!"
Dec 01 2004