Colour

Words to Provide Coloured Characters

_images/colours.terminal.jpg
\ Program Name: colour-term.fs
\ Date: Aug 11 AEDT 2019
\ Copyright 2017  t.porter <terry@tjporter.com.au>, licensed under the GPL
\ For Mecrisp-Stellaris by Matthias Koch
\ This Program : Display colour characters on a serial terminal using ANSI escape codes
\
\ http://tldp.org/HOWTO/Bash-Prompt-HOWTO/x329.html
\ Black       0;30     Dark Gray     1;30
\ Blue        0;34     Light Blue    1;34
\ Green       0;32     Light Green   1;32
\ Cyan        0;36     Light Cyan    1;36
\ Red         0;31     Light Red     1;31
\ Purple      0;35     Light Purple  1;35
\ Brown       0;33     Yellow        1;33
\ Light Gray  0;37     White         1;37
\
\ Example for a terminal with a WHITE background:
\ : colour cr red ." red " green ." green " yellow ." yellow " blue ." blue " magenta ." magenta " cyan ." cyan " black cr ;
\ Example for a terminal with a BLACK background:
\ : colour cr red ." red " green ." green " yellow ." yellow " blue ." blue " magenta ." magenta " cyan ." cyan " white cr ;

compiletoflash

 : esc 27 emit ;
 : black    ( -- cursor colour )  esc ." [30;0m" ;
 : red      ( -- cursor colour )  esc ." [31;1m" ;
 : green    ( -- cursor colour )  esc ." [32;1m" ;
 : yellow   ( -- cursor colour )  esc ." [33;1m" ;
 : blue     ( -- cursor colour )  esc ." [34;1m" ;
 : magenta  ( -- cursor colour )  esc ." [35;1m" ;
 : cyan     ( -- cursor colour )  esc ." [36;1m" ;
 : white    ( -- cursor colour )  esc ." [37;1m" ;

compiletoram