Terminal control/Coloured text: Difference between revisions

Content added Content deleted
m (→‎{{header|Forth}}: fixed </LANG> tag)
Line 634: Line 634:
=={{header|Forth}}==
=={{header|Forth}}==
ANS/ISO Forth does not specify how screen color is handled. This demonstration creates a set of commands for an ANSI terminal that give the programmer control of text color.
ANS/ISO Forth does not specify how screen color is handled. This demonstration creates a set of commands for an ANSI terminal that give the programmer control of text color.
<LANG FORTH>( ANSI terminal control lexicon Colored Text)
<lang FORTH>( ANSI terminal control lexicon Colored Text)
DECIMAL
DECIMAL
( support routines)
( support routines)
Line 654: Line 654:
: TEXT ( color ) 30 + ATTR ; ( use: YELLOW TEXT )
: TEXT ( color ) 30 + ATTR ; ( use: YELLOW TEXT )
: BACKGROUND ( color ) 40 + ATTR ; ( use: BLUE BACKGROUND )
: BACKGROUND ( color ) 40 + ATTR ; ( use: BLUE BACKGROUND )
</LANG>
</lang>
With the code loaded into Forth, color control is a part of the language
With the code loaded into Forth, color control is a part of the language
<lang forth>WHITE TEXT BLUE BACKGROUND ok
<lang forth>WHITE TEXT BLUE BACKGROUND ok
BLUE TEXT BOLD ATTR ok
BLUE TEXT BOLD ATTR ok
CYAN TEXT ok</LANG>
CYAN TEXT ok</lang>


=={{header|Fortran}}==
=={{header|Fortran}}==