textui/display.ts

31 lines
827 B
TypeScript

import { BufferLocation, BufferSize, Char, Color } from "./base.ts";
/**
* Display protocol, to allow the UI to draw things on "screen"
*/
export interface Display {
/**
* Get the displayable grid size
*/
getSize(): Promise<BufferSize>;
/**
* Setup the palette for color display
*
* If the display supports the whole RGB range, it may return the array as-is.
* If the display only supports a limited palette, it may return only supported colors.
*
* From this call forward, colors will be received by numbered index in the returned array.
*/
setupPalette(colors: readonly Color[]): Promise<readonly Color[]>;
/**
* Clear the whole screen
*/
clear(): Promise<void>;
/**
* Draw a single character on screen
*/
setChar(at: BufferLocation, char: Char): Promise<void>;
}