textui/demo.ts

16 lines
392 B
TypeScript
Raw Normal View History

2021-06-24 22:41:34 +00:00
#!./run
2021-05-11 21:20:33 +00:00
import { AnsiTerminalDisplay } from "./ansi.ts";
2021-05-13 22:04:47 +00:00
import { TextUI } from "./ui.ts";
2021-05-11 21:20:33 +00:00
const display = new AnsiTerminalDisplay();
const ui = new TextUI(display);
2021-06-24 22:41:34 +00:00
await ui.init([
{ r: 0, g: 0, b: 0 },
{ r: 1, g: 1, b: 1 },
{ r: 0, g: 1, b: 1 },
]);
ui.drawing.color(2, 0).text("hello", { x: 10, y: 3 });
2021-05-13 22:04:47 +00:00
await ui.flush();
2021-05-11 21:20:33 +00:00
await new Promise((resolve) => setTimeout(resolve, 3000));