Terminal control/Coloured text
The task is to display a a word in various colours on the terminal. The system palette, or colours such as Red, Green, Blue, Magenta, Cyan, and Yellow can be used.
Optionally demonstrate:
- How the system should determine if the terminal supports colour
- Setting of the background colour
- How to cause blinking or flashing (if supported by the terminal)
ZX Spectrum Basic
The ZX Spectrum will always output colour. However if the television is black and white, these will show as various levels of luminence corresponding to the numerical colour value.
<lang zxbasic>10 FOR l=0 TO 7 20 READ c$: REM get our text for display 30 INK l: REM set the text colour 40 PRINT c$ 50 NEXT l 60 PAPER 2: REM red background 70 INK 6: REM yellow forground 80 FLASH 1: REM activate flashing 90 PRINT "Flashing!": REM this will flash red and yellow (alternating inverse) 100 PAPER 7: INK 0: FLASH 0: REM normalize colours before exit 110 STOP
900 DATA "Black","Blue","Red","Magenta","Green","Cyan","Yellow","White" </lang>