textui/mod.ts

15 lines
401 B
TypeScript

import { AnsiTerminalDisplay } from "./ansi.ts";
import { TextUI, UIPalette } from "./ui.ts";
export { TextUI } from "./ui.ts";
export type UIConfig = {
palette: UIPalette;
};
export async function createTextUI(config: UIConfig): Promise<TextUI> {
// TODO detect platform
var display = new AnsiTerminalDisplay();
var ui = new TextUI(display);
await ui.init(config.palette);
return ui;
}