Astro component for DarkMode Switcher for PicoCSS

I am currently evaluating PicoCss V2 in Astro project. PicoCss is a CSS / SCSS framework I used for some of my projects because it is small and brings sufficient styling for most HTML Elements. It has integrated light and dark mode, but no theme switcher.
So i was looking for one and found this one for Pico V1:
https://github.com/RWDevelopment/theme_switch

I adjusted it to Pico V2 in a Astro component, ready to use in a Astro project with Pico V2 as CSS framework.
Since the component is just one file i just a made a gist: https://gist.github.com/ivoba/f3e0a8d7423faf318ce2217f5af9c510

Here is how to use it, f.e. in your navigation:

---
import ThemeSwitcher from "./ThemeSwitcher.astro";
---

...
  
<li>
  <ThemeSwitcher />
</li>Code language: JavaScript (javascript)