#Dark mode toggle in Astro

7 messages · Page 1 of 1 (latest)

brittle beacon
cedar pewter
#

Try to use <script is:inline> in header to determine the current color mode

#

Currently your color mode is not determined until your darkModeToggler component is downloaded and executed. This will be too late.

brittle beacon
#

Great, will check

stiff aspen
#

Hey there! I'm having the same issue, and the is:inline does fix it, however I'm wondering if there's a different way to achieve this without inlining the script? I was hoping to be able to import this script and also maybe bundle it with others, but that's not possible when using is:inline if I'm understanding right (or what I've tried at least).