hello woman and colors

This commit is contained in:
MeexReay 2025-03-20 01:21:45 +03:00
parent 5eed144ff5
commit cc8fe92080
3 changed files with 28 additions and 2 deletions

View File

@ -24,10 +24,10 @@ Github - https://github.com/MeexReay/poshlostios
* reset - УНИЧТОЖИТЬ СИСТЕМУ, и установить заново :3
* cat <file> - показать содержимое файла
* ppm <i/s/r/u/A/a/l> [package] - пакетный менеджер
* woman <article> - руководства по всякому
Планируется:
* сделать hex цвета
* прога Worldwide Objective Manuals (WOMan) которая пишет туторы по пакетам, написанию прог и описание стандартных прог
* прога чтото наподобе nano или vi
`

View File

@ -11,6 +11,7 @@ async function main(args) {
* terminal - Работа с остальными функциями консоли
* packaging - Пакетирование приложений
* graphics - Отрисовка графики
* colors - Цвета в консоли
`)
return 1
}
@ -158,6 +159,18 @@ async function main(args) {
getCursorIndex() -> index - получить индекс курсора в тексте терминала
getCursor() -> [x, y] - получить курсор
`)
return 0
} else if (args[1] == "colors") {
writeStdout(`# Цвета в консоли
Вот как сделать цвет: $$#000000
Вот как убрать цвет: $$reset
Чтоб вывести это в консоль как я щас сделал пиши в начале два доллара
Все понятно?
`)
return 0
} else if (args[1] == "packaging") {

View File

@ -43,7 +43,7 @@ function clearTerminal() {
}
function updateTerminalWOCursor() {
terminal.innerText = terminal_text
terminal.innerHTML = convertColorCodes(terminal_text)
}
function updateTerminal() {
@ -88,6 +88,19 @@ function updateCursor() {
cursor.scrollIntoView({behavior: "smooth", inline: "end"})
}
function convertColorCodes(input) {
return input.replace(/\$\$#([0-9a-fA-F]{6})/g, '$#$1')
.replace(/\$#([0-9a-fA-F]{6})/g, '<span color="#$1">')
.replace(/\$\$reset/g, '$reset')
.replace(/\$reset/g, '</span>');
}
function stripHtml(html) {
let tmp = document.createElement("DIV");
tmp.innerHTML = html;
return tmp.textContent || tmp.innerText || "";
}
document.onkeydown = (e) => {
let key = e.key;
if (!disable_stdin) {