Color Attributes:
The following are examples of values used to select attribute bytes for use with the COLOR and SET COLOR commands.
BASE BACKGROUND COLOR | ADD:TEXT COLOR | ADD:BOLD/BRIGHT | TOTAL VALUE |
0 - black background | 15 - white text | 0 - normal | Total: 15 |
16 - blue background | 14 - yellow text | 0 - normal | Total: 30 |
32 - green background | 0 - black text | 0 - normal | Total: 32 |
48 - cyan background | 0 - black text | 0 - normal | Total: 48 |
64 - red background | 0 - black text | 0 - normal | Total: 64 |
80 - magenta background | 15 - white text | 0 - normal | Total: 95 |
112 - white background | 0 - black text | 0 - normal | Total: 112 |
112 - white background | 0 - black text | 8 - bold | Total: 120 |
Color Examples:
COLOR 15 | white on black (15+0=15) |
COLOR 31 | white on blue (15+16=31) |
COLOR 36 | red on green (4+32=36) |
SET COLOR TO 18 | Sets DEFAULT attribute to green on blue (2+16=18) |
SET COLOR TO 208 | Sets DEFAULT attribute to black on pink (0+208=208) |
SET COLOR TO 30 | Sets DEFAULT attribute to yellow on blue (14+16) |
SET COLOR TO 38 | Sets DEFAULT attribute to bright yellow on blue (14+16+8) |
COLOR 112 | black on white (0+112=112) |
COLOR 36,2,0,12,79 | Changes rows 2-12 to red on green (4+32) |
A Shark Program to Display Color Codes:
Copy the following text into the Shark Write editor (or any ASCII editor like Notepad) and save as a Shark program, e.g. "colors.prg". When run (e.g. "do colors") it will display all the possible colors available on your system. In this Shark example, 260 color choices are displayed::
DO SET_MON cls DO WHILE T; outer loop ON ESCAPE BREAK ENDON DO WHILE T; inner loop cls ON ESCAPE BREAK ENDON *list all color values from 1 to 260 cls r=3 c=0 n=1 DO WHILE n<21 mn=str(n,3) @ r,c SAY mn COLOR n,r,c,r,5 r=r+1 n=n+1 ENDDO * c=6 r=3 n=21 DO WHILE n<41 mn=str(n,3) @ r,c SAY mn COLOR n,r,c,r,11 r=r+1 n=n+1 ENDDO * c=12 r=3 n=41 DO WHILE n<61 mn=str(n,3) @ r,c SAY mn COLOR n,r,c,r,16 r=r+1 n=n+1 ENDDO * c=17 r=3 n=61 DO WHILE n<81 mn=str(n,3) @ r,c SAY mn COLOR n,r,c,r,21 r=r+1 n=n+1 ENDDO * c=22 r=3 n=81 DO WHILE n<101 mn=str(n,3) @ r,c+1 SAY mn COLOR n,r,c,r,26 r=r+1 n=n+1 ENDDO * c=27 r=3 n=101 DO WHILE n<121 mn=str(n,3) @ r,c+1 SAY mn COLOR n,r,c,r,31 r=r+1 n=n+1 ENDDO * c=32 r=3 n=121 DO WHILE n<141 mn=str(n,3) @ r,c+1 SAY mn COLOR n,r,c,r,36 r=r+1 n=n+1 ENDDO * c=37 r=3 n=141 DO WHILE n<161 mn=str(n,3) @ r,c+1 SAY mn COLOR n,r,c,r,41 r=r+1 n=n+1 ENDDO * c=42 r=3 n=161 DO WHILE n<181 mn=str(n,3) @ r,c+1 SAY mn COLOR n,r,c,r,46 r=r+1 n=n+1 ENDDO * c=47 r=3 n=181 DO WHILE n<201 mn=str(n,3) @ r,c+1 SAY mn COLOR n,r,c,r,51 r=r+1 n=n+1 ENDDO * c=51 r=3 n=201 DO WHILE n<221 mn=str(n,3) @ r,c+1 SAY mn COLOR n,r,c,r,56 r=r+1 n=n+1 ENDDO * c=56 r=3 n=221 DO WHILE n<241 mn=str(n,3) @ r,c+1 SAY mn COLOR n,r,c,r,60 r=r+1 n=n+1 ENDDO * c=61 r=3 n=241 DO WHILE n<261 mn=str(n,3) @ r,c+1 SAY mn COLOR n,r,c,r,65 r=r+1 n=n+1 ENDDO @ 1,24 SAY "Shark COLOR COMMAND Syntax:" @ 2,10 SAY "'COLOR N,R,C,R,C' where N=value, R=row#, C=col#" @ 24,0 SAY "Pressto continue . . ." minky=inkey() break cancel ENDDO ;enddo while T