May Site Update
It's Memorial Day weekend, time to officially kick off summer and have a little down time to make some site updates.
The first update: I updated the theme picker code. I've added a "Default" option that does exactly what it sounds like. Previously, if you picked a theme, there was no way to revert back to following your browser's settings. You always had to pick a new theme.
The code change was pretty simple. I now check if there is a saved theme. If there is, I set the theme for the site.
// Set the theme attribute based on what was stored. If nothing was
// stored, then the browser will follow the system preferences.
const theme = getSavedTheme();
theme && setThemeAttribute(theme);
And the new option for "Default" is a blank selection, causing getSavedTheme() to return a "falsy" value. No theme means the browser and CSS prefers-color-scheme: dark take over to render light or dark based on the user preference.
I also added a new "CSS Naked" theme that reverts all the styles to the browser default. I'm a bit late to the party, CSS Naked Day is officially April 9th. But I really liked the concept. I want to have a progressively enhanced site and CSS Naked is a great way to check the structure of the site. It's a great way to make sure it's laid out correctly. The CSS is really simple. Technically, the site is still being styled to not be styled. But work with me here.
:root[data-theme="naked"] {
*,
*::before,
*::after {
all: revert !important;
}
}
The second update: I've been working on some new features to the site's Django code for serving up galleries of pictures I have taken.
Working again with just HTML, CSS, and some server side rendering has been a nice change of pace from doing Single Page Applications. It's been so much easier to work with and I'm guaranteed that things will run when visitors have JavaScript disabled.
My Python skills aren't the greatest yet and I'm sure there are things I could do better. But what I have done so far works perfectly for my needs. Hopefully I can share some pictures in the upcoming months. And some insights into how I built my gallery once it's all ready to go.
- Ben