diff --git a/app/woman/woman.js b/app/woman/woman.js index b77cb62..69ce7cd 100644 --- a/app/woman/woman.js +++ b/app/woman/woman.js @@ -164,10 +164,10 @@ async function main(args) { } else if (args[1] == "colors") { writeStdout(`# Цвета в консоли -Вот как сделать цвет: $$#000000 -Вот как убрать цвет: $$reset +Вот как сделать цвет: $##000000 +Вот как убрать цвет: $#reset -Чтоб вывести это в консоль как я щас сделал пиши в начале два доллара +Чтоб вывести это в консоль как я щас сделал пиши в начале $# вместо просто доллара Все понятно? diff --git a/sys/terminal.js b/sys/terminal.js index 6098c27..c2cacec 100644 --- a/sys/terminal.js +++ b/sys/terminal.js @@ -88,11 +88,15 @@ function updateCursor() { cursor.scrollIntoView({behavior: "smooth", inline: "end"}) } +function stripColors(content) { + return convertColorCodes(content) +} + function convertColorCodes(input) { - return input.replace(/\$\$#([0-9a-fA-F]{6})/g, '$#$1') - .replace(/\$#([0-9a-fA-F]{6})/g, '') - .replace(/\$\$reset/g, '$reset') - .replace(/\$reset/g, ''); + return input.replace(/\$#([0-9a-fA-F]{6})/g, '') + .replace(/\$##([0-9a-fA-F]{6})/g, '$#$1') + .replace(/\$reset/g, '') + .replace(/\$#reset/g, '$reset'); } function stripHtml(html) {