#: 11855 S12/OS9/68000 (OSK)
20-Aug-91 14:08:30
Sb: Color Command
Fm: Kevin Darling 76703,4227
To: Jim Peasley 72726,1153 (X)
Jim, this is scrunched up to fit in a message, but :-)
PROCEDURE color
PARAM p1$,p2$,p3$
DIM color,esc(3):BYTE\ esc(1)=$1b
ON ERROR GOTO 5000\ (* Give help msg if no parms at all
c$=p1$
IF c$="on" THEN \ (* Just do backgnd color if no foregnd
c$=p2$
GOTO 200
ENDIF
GOSUB 1000\ (* convert name to number for foregnd
esc(2)=$32\ esc(3)=color\ PUT #1,esc
ON ERROR GOTO 999\ (* Just exit if other parms missing
c$=p2$
IF c$="on" THEN c$=p N ENDIF
200 GOSUB 1000\ (* convert name to number for backgnd
esc(2)=$33\ esc(3)=color\ PUT #1,esc
999 END
1000 (* Convert c$ to integer color
RESTORE
LOOP
READ test$,color
EXITIF test$="end" THEN GOTO 5000 \ ENDEXIT
IF c$=test$ THEN RETURN \ ENDIF
ENDLOOP
RETURN
DATA "black",0,"grey",1,"gray",1
DATA "blue",2,"green",4,"red",8
DATA "cyan",6,"purple",10,"brown",12
DATA "lblue",3,"lgreen",5,"lred",9
DATA "lcyan",7,"yellow",13,"lgrey",14
DATA "white",15,"end",15
END
5000 (* Give help msg
PRINT "Syntax: color [on] []"
PRINT " color on "
PRINT "Function: change fore/back colors"
PRINT "Colors:"
PRINT " black white grey "
PRINT " red green blue "
PRINT " lred lgreen lblue"
PRINT " brown yellow purple"
END
|