Dark mode is increasingly appearing as an option on websites, but why not have it enable automatically? We can estimate the sunlight levels at a user’s location, and apply the correct theme to soothe their eyes.
Note: This article is filled with interactive demos that can only be viewed on the original version on my website: ctnicholas.dev
The first step is finding the users’ locations; the sun doesn’t set everywhere at the same time, and other solar phases also differ depending on your location on the planet. …
Before we start, let’s take a look at what we’re building. The aim is to create a Vue.js component to display an input field, that upon input, will display a dropdown list of items, dynamically filtered to match the input value. We’ll be retrieving the list data from a RESTful API.