Add pseudo-dark mode while maintaining XP aesthetic
- Create CSS variables for theme customization - Define light and dark XP color schemes - Dark mode uses darker backgrounds, lighter text - Maintain classic XP beveled borders and shadows - Add moon/sun toggle button in title bar - Implement theme switching with localStorage - Support system color scheme preference - Smooth transitions between themes The dark mode keeps the Windows XP look with: - Dark teal/navy desktop background - Dark gray window and button faces - Lighter text colors - Darker gradient title bars - All original XP styling preserved 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,45 @@
|
||||
(() => {
|
||||
// Theme management
|
||||
const themeToggle = document.getElementById("themeToggle");
|
||||
const prefersDark = window.matchMedia("(prefers-color-scheme: dark)");
|
||||
|
||||
function getTheme() {
|
||||
const saved = localStorage.getItem("xp-theme");
|
||||
if (saved) return saved;
|
||||
return prefersDark.matches ? "dark" : "light";
|
||||
}
|
||||
|
||||
function setTheme(theme) {
|
||||
if (theme === "dark") {
|
||||
document.documentElement.setAttribute("data-theme", "dark");
|
||||
if (themeToggle) themeToggle.textContent = "☀️";
|
||||
} else {
|
||||
document.documentElement.removeAttribute("data-theme");
|
||||
if (themeToggle) themeToggle.textContent = "🌙";
|
||||
}
|
||||
localStorage.setItem("xp-theme", theme);
|
||||
}
|
||||
|
||||
function toggleTheme() {
|
||||
const current = document.documentElement.getAttribute("data-theme") === "dark" ? "dark" : "light";
|
||||
setTheme(current === "dark" ? "light" : "dark");
|
||||
}
|
||||
|
||||
// Initialize theme
|
||||
setTheme(getTheme());
|
||||
|
||||
// Listen for theme toggle
|
||||
if (themeToggle) {
|
||||
themeToggle.addEventListener("click", toggleTheme);
|
||||
}
|
||||
|
||||
// Listen for system theme changes
|
||||
prefersDark.addEventListener("change", (e) => {
|
||||
if (!localStorage.getItem("xp-theme")) {
|
||||
setTheme(e.matches ? "dark" : "light");
|
||||
}
|
||||
});
|
||||
|
||||
let qs = new URLSearchParams(window.location.search);
|
||||
const qInput = document.getElementById("q");
|
||||
const channelDropdown = document.getElementById("channelDropdown");
|
||||
|
||||
Reference in New Issue
Block a user