BBS: Inland Empire Archive
Date: 06-13-92 (19:46) Number: 305
From: JEAN CREPEAU Refer#: NONE
To: CHARLIE QUANTE Recvd: NO
Subj: An Interesting Little Fun Conf: (2) Quik_Bas
In a message to ALL, CHARLIE QUANTE wrote:
CQ=> I dink around writing doors for BBS's, and have had a need in the past
to add ANSI colors to various bulletins files. At first I was using a
fifteen element string array, with each element containing the ANSI
codes for that color. For example: C$(1) = CHR$(27) + "[;34;40m"
CQ=> Then when I wanted to add a color to a line of text being sent to a
file, I did something like: PRINT #1, C$(1) + LN$
CQ=> I've come up with a neat little function call that does away with the
CQ=> FUNCTION ANSI$(X)
CQ=> END FUNCTION
CQ=> To add an ansi color to a line being saved I just:
CQ=> Can someone familiar with D'Bridge share the secret of loading an
ascii as a message? That way I don't have to type each example?
You program is not bad, but there is a simpler way to do what you
want to do. The ANSI color numbers follow a rule
color = Red + 2*Green + 4*Blue + 30*FG + 40*BG
The CGA color coding is
color = Blue + 2*Green + 4*Red + 8*HI
Therefore, the color translation should be something simpler than
IF FG AND 8 THEN U$=U$+"1;"
IF FG AND 16 THEN U$=U$+"5;"
ANSICOLOR$=U$ + "3" + MID$(CLR2ANSI$,(FG AND 7)+1,1) + ";4" +_
MID$(CLR2ANSI$,(BG AND 7)+1,1) +"M"
This function accepts exactly the same parameters as the COLOR
* Origin: INTERACESS Montreal (QC) Canada (514) 528-1415 (1:167/280)