37 lines
848 B
TypeScript
37 lines
848 B
TypeScript
/**
|
|
* Color represented by RGB (0.0-1.0) components
|
|
*/
|
|
export type Color = {
|
|
r: number;
|
|
g: number;
|
|
b: number;
|
|
};
|
|
|
|
/**
|
|
* Displayable character, with background and foreground color taken from the palette
|
|
*/
|
|
export type Char = {
|
|
ch: string;
|
|
bg: number;
|
|
fg: number;
|
|
};
|
|
|
|
/**
|
|
* Display protocol, to allow the UI to draw things on "screen"
|
|
*/
|
|
export interface Display {
|
|
/**
|
|
* 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>;
|
|
}
|