new_site/_includes/scripts
Sam Adam-Day c788a30202
Added "follow system" option to theme toggle (#2261)
The theme toggle button now has a third option, which follows the user's
system preferences.

- In the code there's now a distinction between the theme setting (which
can be "dark", "light" or "system") and the computed theme.
- The theme setting is now stored as the "theme-setting" local storage
variable. Since this is different from the old variable ("theme"), this
will effectively reset all current user themes to the default "system".
Maybe this is not what you want.
- The "system" theme icon is currently a half circle symbol.
- The toggle button now displays the current theme setting, rather than
the next theme setting (as far as I know this is consistent with other
sites which have three theme options).
- `theme.js` is now loaded regardless of `site.enable_darkmode`. This is
because other scripts which were always loaded relied on being able to
determine the theme. `theme.js` no longer initialises the theme itself
though; this only happens when `site.enable_darkmode`.
- When the theme setting is "system", the theme will change immediately
whenever the user changes their system theme.

#2261

---------

Signed-off-by: George Araujo <george.gcac@gmail.com>
Co-authored-by: George Araujo <george.gcac@gmail.com>
2024-03-13 22:42:46 -03:00
..
analytics.liquid format code with prettier.io (#2048) 2024-01-10 00:10:51 -05:00
badges.liquid format code with prettier.io (#2048) 2024-01-10 00:10:51 -05:00
bootstrap.liquid format code with prettier.io (#2048) 2024-01-10 00:10:51 -05:00
chartjs.liquid Move libs versions to config (#2139) 2024-01-28 19:10:42 -03:00
diff2html.liquid Added "follow system" option to theme toggle (#2261) 2024-03-13 22:42:46 -03:00
echarts.liquid Added "follow system" option to theme toggle (#2261) 2024-03-13 22:42:46 -03:00
imageLayouts.liquid Move libs versions to config (#2139) 2024-01-28 19:10:42 -03:00
jquery.liquid format code with prettier.io (#2048) 2024-01-10 00:10:51 -05:00
leaflet.liquid Move libs versions to config (#2139) 2024-01-28 19:10:42 -03:00
masonry.liquid Move libs versions to config (#2139) 2024-01-28 19:10:42 -03:00
mathjax.liquid Replace `polyfill.io` (#2241) 2024-03-04 11:37:16 -03:00
mermaid.liquid Added "follow system" option to theme toggle (#2261) 2024-03-13 22:42:46 -03:00
misc.liquid Add functionality to open external links in jupyter notebooks in new tab (#2233) 2024-02-27 12:25:16 -03:00
progressBar.liquid format code with prettier.io (#2048) 2024-01-10 00:10:51 -05:00
tikzjax.liquid Move libs versions to config (#2139) 2024-01-28 19:10:42 -03:00
vega.liquid Added "follow system" option to theme toggle (#2261) 2024-03-13 22:42:46 -03:00
wechatModal.liquid format code with prettier.io (#2048) 2024-01-10 00:10:51 -05:00