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:

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:

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

import ThemeSwitcher from "./ThemeSwitcher.astro";

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