welpo / tabi

A modern Zola theme with search, multilingual support, optional JavaScript, a perfect Lighthouse score, and a focus on accessibility.

Home Page:https://welpo.github.io/tabi/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Comply with the default_theme value for the first load of the website (when theme_switcher = true)

kbrault opened this issue · comments

Feature Request

Summary

When theme_switcher = true and default_theme = "light" --> the default theme loaded should be the light one.
In practice, even if the default_theme is light and theme_switcher is true, the dark theme is always loaded the first time (when cookies are empty).

Motivation

I wish the loaded theme would respects the default_theme value for the first load of the website.

Hi Kévin!

Thanks for requesting this feature. One note:

the dark theme is always loaded the first time (when cookies are empty)

This should only be the case if your system is using the dark theme. The current behaviour is to follow the OS preference when the theme switcher is enabled. If you switch to light theme, the site should also show the light theme. The default_theme is used as fallback when JS is disabled.

That said, you're right, it does make more sense to use the default_theme both when JS is disabled (current) as well as when it's enabled.

This will be a breaking change, but I think it's worth it.

Working on it!

Done in #224.

Don't hesitate to reach out if you encounter any issues.

Thanks again for your report and for using tabi! 🫶