fix fucking colors

This commit is contained in:
MeexReay 2025-03-20 01:28:51 +03:00
parent cb5f2d9dd7
commit 6e10736d97
2 changed files with 11 additions and 7 deletions

View File

@ -164,10 +164,10 @@ async function main(args) {
} else if (args[1] == "colors") { } else if (args[1] == "colors") {
writeStdout(`# Цвета в консоли writeStdout(`# Цвета в консоли
Вот как сделать цвет: $$#000000 Вот как сделать цвет: $##000000
Вот как убрать цвет: $$reset Вот как убрать цвет: $#reset
Чтоб вывести это в консоль как я щас сделал пиши в начале два доллара Чтоб вывести это в консоль как я щас сделал пиши в начале $# вместо просто доллара
Все понятно? Все понятно?

View File

@ -88,11 +88,15 @@ function updateCursor() {
cursor.scrollIntoView({behavior: "smooth", inline: "end"}) cursor.scrollIntoView({behavior: "smooth", inline: "end"})
} }
function stripColors(content) {
return convertColorCodes(content)
}
function convertColorCodes(input) { function convertColorCodes(input) {
return input.replace(/\$\$#([0-9a-fA-F]{6})/g, '$#$1') return input.replace(/\$#([0-9a-fA-F]{6})/g, '<span style="color: #$1">')
.replace(/\$#([0-9a-fA-F]{6})/g, '<span color="#$1">') .replace(/\$##([0-9a-fA-F]{6})/g, '$#$1')
.replace(/\$\$reset/g, '$reset') .replace(/\$reset/g, '</span>')
.replace(/\$reset/g, '</span>'); .replace(/\$#reset/g, '$reset');
} }
function stripHtml(html) { function stripHtml(html) {