Interfaces
ConsoleOptions
Options for a Console. In addition to the optional print/printErr
sinks, the canvas-backed terminal can be styled via TerminalOptions
(theme colors, font size, scrollback, cursor, etc.).
For the global console, assign these options to Console.options
before the first output (e.g. at the top of your app) — the underlying
terminal is created lazily, so the options take effect on first render:
console.options = {
fontSize: 24,
theme: { background: '#002b36', foreground: '#839496' },
};Extends
Properties
| Property | Type | Description | Inherited from |
|---|---|---|---|
cursorOpacity? | number | Opacity of the cursor, 0-1. Default 0.5 | TerminalOptions.cursorOpacity |
cursorStyle? | CursorStyle | Cursor shape. Default 'block' | TerminalOptions.cursorStyle |
fontSize? | number | Font size in pixels. Default 20 | TerminalOptions.fontSize |
height? | number | Height of the backing canvas in pixels. Default 720 | TerminalOptions.height |
lineHeight? | number | Line height as a multiple of the font size. Default 1.25 | TerminalOptions.lineHeight |
scrollback? | number | Scrollback buffer size (rows). Default 1000 | TerminalOptions.scrollback |
theme? | ConsoleTheme | Color theme. In addition to background / foreground / cursor, the full ANSI palette (black..brightWhite) is honored. | TerminalOptions.theme |
width? | number | Width of the backing canvas in pixels. Default 1280 | TerminalOptions.width |
Methods
print()?
optional print(s): void
Parameters
| Parameter | Type |
|---|---|
s | string |
Returns
void
printErr()?
optional printErr(s): void
Parameters
| Parameter | Type |
|---|---|
s | string |
Returns
void