REM custom R G B foreground and background control (total control)
MODE 8
VDU 5 : REM Treat text as graphics (transparent background)
REM set background color to white
PROC_color("b",255,255,255)
REM clear the screen with background color
CLG
REM set foreground color to blue
PROC_color("f",0,0,255)
MOVE 0,800
PRINT "text is a custom blue and background is custom white"
PROC_color("f",50,150,255)
PRINT "text is now a custom color"
WAIT 0
END
DEF PROC_color(fb$,r,g,b)
IF fb$="f" OR fb$="F" THEN COLOUR 0,r,g,b : GCOL 0
IF fb$="b" OR fb$="B" THEN COLOUR 1,r,g,b : GCOL 128+1
ENDPROC
MODE 8
COLOUR 1,255,255,255 REM Set palette color 1 to RGB triplet (my custom text background color)
GCOL 0 : REM Set graphics foreground to palette color 0 (BLACK)
GCOL 128+1 : REM Set graphics background to palette color 1
VDU 5 : REM Treat text as graphics (transparent background)
OFF
CLG
initialx%=0
PROC_pr(100,500,9,15,"COLORED TEXT BOX WITH ANY FILL COLOR AND BORDER COLOR",150,20,100)
PROC_pr(10,300,2,5,"But I am having issues centering my text",150,155,255)
PROC_pr(200,200,4,4,"Maybe someone could help me do the math?",250,150,200)
PROC_color("f",0,0,0) REM set draw color to black
MOVE 0,800
PRINT "I printed this black text using a custom color with PROC_color"
PROC_pr(10,900,4,4,"TINY BOX?",250,190,100)
MOVE 0,0 REM move the > out of view
WAIT 0
END
REM X,Y,text color,boarder color,message,r,g,b
DEF PROC_pr(X,Y,C,CT,msg$,r,g,b)
initialx%=LEN(msg$)
COLOUR 0,r,g,b
GCOL 0
LET tx= X+initialx%+25
LET ty= Y
initialx%=initialx%*22
FOR fill=1 TO 58
LINE X+3,Y+20-fill,X+initialx%,Y+20-fill
NEXT fill
GCOL CT
MOVE tx,ty
PRINT msg$
GCOL C
LINE X,Y+20,X+initialx%,Y+20
LINE X,Y+20,X,Y-40
LINE X,Y-40,X+initialx%,Y-40
LINE X+initialx%,Y-40,X+initialx%,Y+20
LINE X-5,Y+25,X+initialx%+5,Y+25
LINE X-5,Y+25, X-5,Y-45
LINE X+initialx%+5,Y+25,X+initialx%+5,Y-45
LINE X-5,Y-45,X+initialx%+5,Y-45
MOVE 0,0 REM hide that thing
ENDPROC
DEF PROC_color(fb$,r,g,b)
IF fb$="f" OR fb$="F" THEN COLOUR 0,r,g,b : GCOL 0
IF fb$="b" OR fb$="B" THEN COLOUR 1,r,g,b : GCOL 128+1
ENDPROC