Vt

From MiniScript Wiki
Jump to navigation Jump to search

This system module defines some special strings which, when printed on a VT100 or compatible terminal window, cause special things to happen: clear the screen, move the cursor, turn bold text on/off, etc.

Functions

Name Description
textColor(color) Sets the foreground color of the text. Specify a single number (index into the 256-color palette), or an [r,g,b] (each 255) list, or a RGB color string like "#FF8800". (In the latter two cases, we will automatically find as close match as we can in the color palette.)
backColor(color) Sets the background color of the text. Specify a single number (index into the 256-color palette), or an [r,g,b] (each 255) list, or a RGB color string like "#FF8800". (In the latter two cases, we will automatically find as close match as we can in the color palette.)
ledOn(n=1) Turns on LEDs, if your terminal has these (most don't anymore)
ledOff Turns off LEDS. Same as calling ledOn(0).

Properties

color

Map of color names (to palete index) for use with textColor and backColor. But note that you are not limited to these colors! See notes above.

Name Value
color.aqua 51
color.black 232
color.blue 21
color.brown 137
color.fuchsia 201
color.gray 244
color.green 34
color.lime 46
color.maroon 124
color.navy 19
color.olive 142
color.orange 214
color.pink 217
color.purple 127
color.red 196
color.silver 250
color.teal 37
color.white 255
color.yellow 226

cursor

A map of cursor movement escape codes

Name Description
cursor.up(n=1) Moves cursor up n lines
cursor.down(n=1) Moves cursor down n lines
cursor.left(n=1) Moves cursor left n characters
cursor.right(n=1) Moves cursor right n characters
cursor.nextLine Moves cursor to beginning of the next line of characters
cursor.home Moves cursor to upper left
cursor.save Saves cursor position and attributes
cursor.restore Restores cursor position and attributes

tab

A map of tab escape codes

Name Description
tab.set Sets a tab stop at the current column
tab.clear Clear a tab stop at the current column
tab.clearAll Clears all tab stops

text size

Escape codes for changing the text size

Name Description
bigTextTop big text! Requires printing your message twice, once with the "top half" mode
bigTextBottom and again with the "bottom half".
wide or you can print double-wide, normal-height text.
normalSize Turns off any of these size changes.

clearing text

Escape codes to clear all or part of the screen

Name Description
clear Clear entire screen
clearLineToRight Clear line from cursor right
clearLineToLeft Clear line from cursor left
clearLine Clear entire line
clearBelow Clear screen from cursor down
clearAbove Clear screen from cursor up
reset Clears, plus also resets all state