import { Color, Display } from "./display.ts"; /** * ANSI terminal display */ export class AnsiTerminalDisplay implements Display { constructor(private writer: Deno.Writer = Deno.stdout) { } async setupPalette(colors: readonly Color[]): Promise { return colors; } async clear(): Promise { await this.writer.write(CLEAR); } } function escape(sequence: string): Uint8Array { return new Uint8Array([0x1B, ...new TextEncoder().encode(sequence)]); } const CLEAR = escape("[2J");