diff --git a/src/api/init.ts b/src/api/init.ts index f375ce5..1030c45 100644 --- a/src/api/init.ts +++ b/src/api/init.ts @@ -39,8 +39,8 @@ const initTerminal = ({ inputContainer, input, - print: (content: string, isCommand = false, scrollIntoView = true) => - print(content, isCommand, scrollIntoView, commandContainer, input, settings), + print: (content: string, isCommand = false, scrollIntoView = true, cstyle?: string) => + print(content, cstyle, isCommand, scrollIntoView, commandContainer, input, settings), run: (cmd: string) => evalCommand(cmd, terminal), start: () => startProcess(terminal), stop: () => stopProcess(terminal), diff --git a/src/api/print.ts b/src/api/print.ts index 9527b47..3603bdf 100644 --- a/src/api/print.ts +++ b/src/api/print.ts @@ -4,13 +4,14 @@ import { TerminalSettings } from '../types' // Prints a new line in the terminal const print = ( content: string, + cstyle: string | undefined, isCommand: boolean, scrollIntoView: boolean, commandContainer: HTMLElement, input: HTMLElement, settings: TerminalSettings ) => { - const line = create('p', undefined, isCommand ? settings.prompt : content) + const line = create('p', cstyle , isCommand ? settings.prompt : content) if (isCommand) { const cmd = create('span', 'terminal-command', content) line.append(cmd) diff --git a/src/types/terminal.ts b/src/types/terminal.ts index 28e0270..65b29db 100644 --- a/src/types/terminal.ts +++ b/src/types/terminal.ts @@ -7,7 +7,7 @@ export type TerminalInstance = { input: HTMLInputElement history: string[] lastHistoryIndex: number - print: (text: string, isCommand?: boolean, scrollIntoView?: boolean) => void + print: (text: string, isCommand?: boolean, scrollIntoView?: boolean, cstyle?: string) => void run: (cmd: string) => void start: () => void stop: () => void