This time I made some improvements to the website. ## Watch out, construction site! Ever since I've bought my domain, I've been putting all the actual content of my website to thematic subdomains. Since I had nothing to put to the main domain I just used it as a sort of dead-end for the website, with the following game over text from the [Legend of Zelda: Majora's Mask](https://en.wikipedia.org/wiki/The_Legend_of_Zelda:_Majora%27s_Mask): """You've met with a terrible fate, haven't you? "" Majora's Mask, 2000 """ After creating more and more silly little projects on the site, I soon realized it was time for me to **create** at least **some sort of menu** where a random visitor can check all the subdomains out (especially since I myself was starting to forget just _what_ all the current projects/subdomains were). So a few days ago I've put together this horrible abomination of a webpage for my main domain. I'm going to include a screenshot of it, in case I ever decide to change it to something less a crime against humanity: ![an image with a very basic menu with ugly colored buttons and an UNDER CONSTRUCTION banner](main_domain.webp "No, thank you, IT companies, I'm not interested in frontend design, you can stop sending me job offers!" "https://wazul.moe" "It was a fun exercise for hand-coded svg at least...") ## Starting to feel like an icon (would look good on the sidebar) I also added a few more links to the sidebar, like my Mastodon which I'm planning to start using more frequently again. So I had to add a few **icons for these entries** (and the Arch Linux logo btw). Luckily [iconify](https://icon-sets.iconify.design) had some really cute Apache license icons which suited my purpose perfectly. ## Return of the light theme Though the first iteration of the blog had white background, it was hardly what you could call a *light theme*. You can check out how it looked in the [first blogpost](/posts/2024/let-there-be-light-theme). After I received some advice that I should actually **implement a light theme** (and I myself experienced just how hard it is to read anything on the blog while sitting outdoors on a platform of the train station with my laptop on my lap during daytime), I've felt it might actually be a good idea to do it. My first question was _how_ to do it. Luckily I was already working with a predefined **palette of colors** for the 8 ANSI color (plus foreground and background). These were defined in the :root of the css file, so the only thing I had to do was change those when another theme was set. I know that prefers-color-scheme: light is a thing in css, but I was not fond of only using that for setting the preferred theme for multiple reasons: - I may want to change the theme **manually** even if I have a system preference (like on the train station; see above); dark mode is sometimes called night mode for a _reason_ - {{foreshadowing}} I might want **more than two** color schemes {{}}; let's get the most out of the system if I implement it anyway - totally personal reason: I prefer dark mode, but I use Firefox with **fingerprintingProtection**, so my agent always lies light mode preference :) So of course my other choice was good old **javascript**. I wanted to avoid using javascript on the blog for as long as I can. Three blogposts was the limit as it turns out. ### Setting theme with "shell scripts" I wanted the theme changing section of the sidebar to look thematically similar to the rest of the blog. So just like the tag listing, I went with a listing of **"shell scripts"** for the themes, and colored them green (the color for files with execute permission in ls). So while they essentially **work like buttons**, they **look more like links**. That's because they are:
<a href="javascript:void(0);" class="icon-text theme-selector-light" onclick="setTheme('light')"> <img src="/assets/image/sun.svg" class="svg-icon"> <span>sweet-celestial.sh</span> </a>
const THEME_KEY = "data-theme";
function updateTheme() { let theme = localStorage.getItem(THEME_KEY); if (theme != null) { document.documentElement.setAttribute(THEME_KEY, theme) } }
function setTheme(theme) { localStorage.setItem(THEME_KEY, theme); updateTheme(); }
.filter-yellow { filter: brightness(0) saturate(100%) invert(91%) sepia(86%) saturate(596%) hue-rotate(314deg) brightness(96%) contrast(97%); }
<span> <input type="checkbox" class="spoiler" id="spoiler5"> <label class="spoiler-on" for="spoiler5"> <span>▉▉▉ ▉▉▉ ▉▉▉ ▉▉▉</span> </label> <label class="spoiler-off" for="spoiler5"> <span>Now you see me!</span> </label> </span>
.spoiler { position: absolute; left: -10000px; }
.spoiler:checked ~ label.spoiler-on, .spoiler:not(:checked) ~ label.spoiler-off { display: none; }
label.spoiler-on { background-color: var(--term-fg); }
label.spoiler-off { background-color: var(--term-black); }