/** * Output implementation for termenv. * Port of github.com/muesli/termenv Output struct to TypeScript. */ import { Style } from './style.js'; import { type Color, type Environ, type Output as IOutput, type OutputOption, Profile, RGBColor } from './types.js'; /** * Output implementation class - direct port of Go Output struct */ export declare class OutputImpl implements IOutput { profile: Profile; assumeTTY: boolean; unsafe: boolean; cache: boolean; environ: Environ; private _writer; private _fgColor; private _bgColor; private _fgCached; private _bgCached; private _screen; private _hyperlink; private _notification; constructor(writer: NodeJS.WriteStream | NodeJS.WritableStream, ...opts: OutputOption[]); writer(): NodeJS.WriteStream | NodeJS.WritableStream; write(data: Uint8Array): Promise; writeString(s: string): Promise; string(...strings: string[]): Style; String(...strings: string[]): Style; Color(s: string): Color | null; ColorProfile(): Profile; EnvColorProfile(): Profile; EnvNoColor(): boolean; HasDarkBackground(): boolean; ForegroundColor(): Color; BackgroundColor(): Color; isTTY(): boolean; colorProfile(): Profile; envColorProfile(): Profile; envNoColor(): boolean; private cliColorForced; foregroundColor(): Color; backgroundColor(): Color; private _foregroundColor; private _backgroundColor; hasDarkBackground(): boolean; /** * Color creates a Color from a string. Valid inputs are hex colors, as well as * ANSI color codes (0-15, 16-255). * This method is a direct port of the Go Profile.Color method, adapted for Output. */ color(s: string): Color | null; /** * Convert transforms a given Color to a Color supported within the current Profile. * Port of Go Profile.Convert method. */ private convertColor; /** * Convert ANSI256Color to ANSIColor using HSLuv distance matching. * Port of Go ansi256ToANSIColor function. */ private ansi256ToANSIColor; /** * Convert RGB color to ANSI256Color using the same algorithm as Go. * Port of Go hexToANSI256Color function. */ private hexToANSI256Color; moveCursor(row: number, column: number): void; cursorUp(n?: number): void; cursorDown(n?: number): void; cursorForward(n?: number): void; cursorBack(n?: number): void; saveCursorPosition(): void; restoreCursorPosition(): void; hideCursor(): void; showCursor(): void; clearScreen(): void; clearLine(): void; clearLines(n: number): void; altScreen(): void; exitAltScreen(): void; saveScreen(): void; restoreScreen(): void; reset(): void; setForegroundColor(color: Color): void; setBackgroundColor(color: Color): void; setCursorColor(color: Color): void; setWindowTitle(title: string): void; enableMouse(): void; disableMouse(): void; enableMousePress(): void; disableMousePress(): void; enableMouseHilite(): void; disableMouseHilite(): void; enableMouseCellMotion(): void; disableMouseCellMotion(): void; enableMouseAllMotion(): void; disableMouseAllMotion(): void; enableMouseExtendedMode(): void; disableMouseExtendedMode(): void; enableMousePixelsMode(): void; disableMousePixelsMode(): void; enableBracketedPaste(): void; disableBracketedPaste(): void; changeScrollingRegion(top: number, bottom: number): void; insertLines(n: number): void; deleteLines(n: number): void; hyperlink(link: string, name: string): void; notify(title: string, body: string): void; } /** * Factory functions and options - direct port of Go functions */ export declare function newOutput(writer?: NodeJS.WriteStream | NodeJS.WritableStream, ...opts: OutputOption[]): OutputImpl; export declare function withProfile(profile: Profile): OutputOption; export declare function withColorCache(enabled: boolean): OutputOption; export declare function withEnvironment(environ: Environ): OutputOption; export declare function withTTY(assumeTTY: boolean): OutputOption; export declare function withUnsafe(): OutputOption; /** * Global default output management */ export declare function defaultOutputInstance(): OutputImpl; export declare function setDefaultOutput(output: OutputImpl): void; /** * Parse xTerm color response - simplified version of Go xTermColor function */ export declare function parseXTermColor(s: string): RGBColor | null; //# sourceMappingURL=output.d.ts.map