diff --git a/static/stylesheet.css b/static/stylesheet.css index 2d70cfc..c2f2158 100644 --- a/static/stylesheet.css +++ b/static/stylesheet.css @@ -1,6 +1,15 @@ +:root { + --bg-color: #222; + --text-color: #eee; + --command-color: #75df0b; + --error-color: #ff5555; + --directory-color: #1bc9e7; +} + +/* Default is pwny theme */ body { - background-color: #222; - color: #eee; + background-color: var(--bg-color); + color: var(--text-color); font-family: monospace; font-size: 14pt; margin: 0; @@ -21,8 +30,8 @@ body { } input { font-size: 14pt; - background: #222; - color: #eee; + background: var(--bg-color); + color: var(--text-color); border: none; width: 80%; font-family: monospace; @@ -31,11 +40,35 @@ input:focus { outline: none; } span.command { - color: #75df0b; + color: var(--command-color); } span.error { - color: #ff5555; + color: var(--error-color); } span.directory { - color: #1bc9e7; + color: var(--directory-color); +} + +.light-theme { + --bg-color: #fff; + --text-color: #222; + --command-color: #007700; + --error-color: #cc0000; + --directory-color: #0044cc; +} + +.catppuccin-theme { + --bg-color: #363a4f; + --text-color: #cad3f5; + --command-color: #a6da95; + --error-color: #ed8796; + --directory-color: #7dc4e4; +} + +.doom1-theme { + --bg-color: #0a0a0a; + --text-color: #f8f8f2; + --command-color: #50fa7b; + --error-color: #ff5555; + --directory-color: #8be9fd; } diff --git a/static/switch-themes.js b/static/switch-themes.js new file mode 100644 index 0000000..7678134 --- /dev/null +++ b/static/switch-themes.js @@ -0,0 +1,46 @@ +document.addEventListener("DOMContentLoaded", function () { + const input = document.getElementById("command-input"); + const terminal = document.getElementById("terminal"); + const availableThemes = ["pwny", "light", "catppuccin", "doom1"]; + + // Load the saved theme from localStorage, defaulting to "pwny" + let currentTheme = localStorage.getItem("theme") || "pwny"; + applyTheme(currentTheme); + + input.addEventListener("keydown", function (event) { + if (event.key === "Enter") { + const command = input.value.trim(); + if (command.startsWith("theme")) { + event.preventDefault(); + const parts = command.split(" "); + if (parts.length === 1) { + addLogEntry(`Available themes: ${availableThemes.join(', ')}. Current theme: ${currentTheme}`, 'info'); + } else { + const theme = parts[1]; + applyTheme(theme); + addLogEntry(`Theme changed to: ${theme}`, 'info'); + } + input.value = ''; // Clear input + } + } + }); + + function applyTheme(themeName) { + if (availableThemes.includes(themeName)) { + document.body.className = ""; // Clear all theme classes + document.body.classList.add(`${themeName}-theme`); // Add the new theme class + localStorage.setItem("theme", themeName); + currentTheme = themeName; + } else { + addLogEntry(`Error: Theme "${themeName}" not found. Available themes: ${availableThemes.join(', ')}`, 'error'); + } + } + + function addLogEntry(message, type) { + const logEntry = document.createElement("div"); + logEntry.classList.add(type === 'error' ? 'error' : 'info'); + logEntry.textContent = message; + terminal.appendChild(logEntry); + terminal.scrollTop = terminal.scrollHeight; + } +}); diff --git a/templates/index.html b/templates/index.html index 9707fba..47e606f 100644 --- a/templates/index.html +++ b/templates/index.html @@ -6,6 +6,7 @@