If you are outputting to a terminal, you may want to control the positioning of the cursor:
at-xy
( x y – ) facility “at-x-y”
Put the curser at position x y. The top left-hand corner of the display is at 0 0.
at-deltaxy
( dx dy – ) gforth-0.7 “at-deltaxy”
With the current position at x y, put the cursor at x+dx y+dy.
In order to know where to position the cursor, it is often helpful to know the size of the screen:
form
( – nlines ncols ) gforth-0.2 “form”
And sometimes you want to use:
page
( – ) facility “page”
Clear the screen
Note that on non-terminals you should use 12 emit
, not
page
, to get a form feed.
The following words are used to create (semantic) colorful output; further output is produced in the color and style given by the word; the actual color and style depends on the theme (see below).
default-color
( – ) gforth-1.0 “default-color”
use system-default color
error-color
( – ) gforth-1.0 “error-color”
error color: red
error-hl-inv
( – ) gforth-1.0 “error-hl-inv”
color mod for error highlight inverse
error-hl-ul
( – ) gforth-1.0 “error-hl-ul”
color mod for error highlight underline
warning-color
( – ) gforth-1.0 “warning-color”
color for warnings: blue/yellow on black terminals
info-color
( – ) gforth-1.0 “info-color”
color for info: green/cyan on black terminals
success-color
( – ) gforth-1.0 “success-color”
color for success: green
input-color
( – ) gforth-1.0 “input-color”
color for user-input: black/white (both bold)
status-color
( – ) gforth-1.0 “status-color”
color mod for status bar
compile-color
( – ) gforth-1.0 “compile-color”
color mod for status bar in compile mode
Depending on wether you prefer bright or dark background the foreground colors-theme can be changed by:
light-mode
( – ) gforth-1.0 “light-mode”
color theme for white background
dark-mode
( – ) gforth-1.0 “dark-mode”
color theme for black background
uncolored-mode
( – ) gforth-1.0 “uncolored-mode”
This mode does not set colors, but uses the default ones.
magenta-input
( – ) gforth-1.0 “magenta-input”
make input color easily recognizable (useful in presentations)
default-input
( – ) gforth “default-input”
make input color easily recognizable (useful in presentations)
Gforth tries to select the best mode automatically. You can set the
environment variable GFORTH_INIT
to light
, dark
,
uncolored
, or auto
(same effect if not setting it at all),
to tell Gforth your preference, as well as magenta
or
default
for the input color preference. Concatenate options with
space as separator.