Speyll/anemone

Minor bug with setting default between dark/light mode

Closed this issue · 0 comments

Hi, I encountered a bug where the setting for default_theme in config.toml wasn't properly applying when default was set to "dark."

After some digging, I found that line 9 in static/js/script.js isn't working as intended:

if (!hasCodeRun) {
  const defaultTheme = "{{ config.extra.default_theme }}";
  setTheme(defaultTheme);
  localStorage.setItem('hasCodeRun', 'true');
}

{{ config.extra.default_theme}} was getting passed to defaultTheme instead of just dark.

I managed to get it to work as intended by copying the whole script into templates/head.html.

Love the theme, by the way.