The simple answer is that you need to set the foreground colour for graphics, which you can do with the GCOL command:
Code: Select all
GCOL 1 :REM set the foreground colour to red
GCOL can take a single parameter from 0 to 15, which will set the foreground colour to one of the pre-specified colours (black, red, green, yellow, blue, magenta, cyan, and then the same plus "added white" - so brighter versions of the above. 15 is pure white.
A slightly more complex, but hopefully useful, guide is that the (default) colour number uses bit 1 to indicate red content, 2 for green, and 3 for blue, with bit 4 meaning "brighter". So 6 is bit 3 (4) plus bit 2 (2): blue+green is cyan.
If you want more control over the exact colour, you can reprogram the colours, using a version of the COLOUR command with 4 parameters. The first is the colour you want to change (0-15), and then come three values (0-255) for red, green and blue. For example, to reset colour 1 to a mid-brown, you could do
. When you change the colour like this you won't change anything you've already displayed, but anything you plot in colour 8 subsequently will have the new colour.
A couple of other things you might want to know:
1) At the moment you are plotting in the default display window, which is fine, but depends in size on the specific computer it is running on[EDIT -in BBC Basic for Windows]. You might want to consider using the MODE command to set a specified window size, so that you know how many pixels you have to play with. Note that this will also (by default) change the background colour to black (colour 0) and reset the palette, so I'd do this first! [EDIT: It's been pointed out that your post implies that you are using BBC_SDL, for which the default window IS always the same size, so that issue doesn't apply.]
2) You can change the background graphics colour using GCOL 128+[colour number]. You'll then need to clear the graphics window (CLG) before the change takes place.
3) Your code uses lower case keywords, which may be convenient, but (a) risks clashes with useful variable names, and (b) may fox those on the forum who always use upper case keywords. I'd encourage you to consider sticking with upper case keywords.
So I might amend your program as follows:
Code: Select all
MODE 21 :REM Set a window of 800 x 600 pixels (1600 x 1200 graphics units)
COLOUR 8,200,100,50 :REM Redefine colour 8 as brown
GCOL 8 :REM Select our new brown colour as the foreground colour
Hope that's useful!