mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-05 19:20:12 +08:00
change color in content, bigger text in term
This commit is contained in:
1 parent
849e669147
commit
8fb8af036d
2 files changed
+19
-7
No files matched your search
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user