A floating button injects a sun/moon toggle that persists the user's preference and also respects their OS setting on first visit.
Pure JS. Works with any Squarespace template. Toggle position is configurable: bottom-right, bottom-left, top-right, top-left.
The plugin sets custom CSS variables on body. Your Squarespace CSS can reference them for further theming beyond just background and text.
On first visit, if no localStorage key is set, the plugin checks prefers-color-scheme and applies dark mode automatically if the user's OS is in dark mode.
Look for the toggle button in the bottom-right corner