@taml/encoder
Version:
Convert ANSI escape sequences to TAML (Terminal ANSI Markup Language) tags
70 lines (64 loc) • 1.15 kB
text/typescript
export interface AnsiState {
foreground: string | null;
background: string | null;
bold: boolean;
dim: boolean;
italic: boolean;
underline: boolean;
strikethrough: boolean;
}
export interface ColorRGB {
r: number;
g: number;
b: number;
}
export interface ParsedAnsiSequence {
type:
| "color"
| "background"
| "style"
| "reset"
| "foreground-reset"
| "background-reset";
value: string | number | null;
raw: string;
}
export interface AnsiToken {
type: "text" | "sequence";
content: string;
sequence?: ParsedAnsiSequence;
}
export type StandardColor =
| "black"
| "red"
| "green"
| "yellow"
| "blue"
| "magenta"
| "cyan"
| "white"
| "brightBlack"
| "brightRed"
| "brightGreen"
| "brightYellow"
| "brightBlue"
| "brightMagenta"
| "brightCyan"
| "brightWhite";
export type BackgroundColor =
| "bgBlack"
| "bgRed"
| "bgGreen"
| "bgYellow"
| "bgBlue"
| "bgMagenta"
| "bgCyan"
| "bgWhite"
| "bgBrightBlack"
| "bgBrightRed"
| "bgBrightGreen"
| "bgBrightYellow"
| "bgBrightBlue"
| "bgBrightMagenta"
| "bgBrightCyan"
| "bgBrightWhite";