diff --git a/app/src/utils/terminal.js b/app/src/utils/terminal.js index 528dd8d..6ecb321 100644 --- a/app/src/utils/terminal.js +++ b/app/src/utils/terminal.js @@ -13,12 +13,11 @@ class SocketTerminal { disableStdin: false, // 是否应禁用输入 // cursorStyle: "underline", //光标样式 cursorBlink: true, // 光标闪烁 - theme: { - foreground: '#ECECEC', // 字体 - background: '#000000', // 背景色 - cursor: 'help', // 设置光标 - lineHeight: 20, - }, + foreground: '#ECECEC', // 字体 + background: '#000000', // 背景色 + cursor: 'help', // 设置光标 + fontSize: 18, + fontWeight: 'bold', }) this.fitAddon = new FitAddon() this.term.loadAddon(this.fitAddon) diff --git a/packages/container/print.js b/packages/container/print.js index 6c6a161..35a8af2 100644 --- a/packages/container/print.js +++ b/packages/container/print.js @@ -36,12 +36,25 @@ function waitForEnter() { }) } +function isCodeColor(text, isCode) { + if (text === '`') { + return !isCode + } + return isCode +} + function printLine(content, delay, color) { const printContent = `${colorize(content, color)}${RETURN_SYMBOL}` + let isCode = false return new Promise((resolve) => { let i = 0 const timer = setInterval(() => { - process.stdout.write(printContent[i]) + isCode = isCodeColor(printContent[i], isCode) + if (isCode) { + process.stdout.write(colorize(printContent[i], 'green')) + } else { + process.stdout.write(printContent[i]) + } i += 1 if (i >= printContent.length) { clearInterval(timer)