I added dark mode to my blog! Inspired by Jeremy Keith, I used CSS custom properties and media queries to switch between light and dark themes based on the user's preference. I also included a fallback for browsers that don't support custom properties and a temporary CSS class for testing since Chrome DevTools didn't yet have dark mode emulation.
I explored the Ambient Light Sensor API, a new feature available in PWAs. It lets developers access ambient light levels in lux units, useful for various applications like smart home lighting control or adjusting app brightness based on environmental conditions. The API is built on the Generic Sensor API, which also supports other sensors like gyroscopes and magnetometers. I previously discussed the Generic Sensor API at Chrome Dev Summit 2016, and it's now available in Edge and Chrome (behind a flag).