Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ feat(theme-switcher)!: respect theme_default when JS is enabled #224

Merged
merged 1 commit into from
Nov 24, 2023

Conversation

welpo
Copy link
Owner

@welpo welpo commented Nov 24, 2023

‼️ BREAKING CHANGE ‼️

If you had default_theme set and want the colourscheme to follow user OS preferences (as it did before this PR), set default_theme = "" or comment it out on your config.toml.

Summary

This PR ensures the default_theme specified in config.toml is respected on first load.

Related issue

Resolves #223.

Changes

  • Updated initializeTheme to prioritize the default_theme setting from the config.toml file, ensuring that this setting is respected on the first website load.
  • Modified themeSwitcher script to include a defaultTheme variable and updated the theme application logic to align with the new initial theme setting approach.
  • Enhanced the themeSwitcher script's functionality for resetting the theme, now prioritizing the default_theme setting.

Accessibility

This update maintains the existing accessibility features, including semantic HTML, ARIA attributes, and keyboard navigation compatibility.

Type of change

  • UI/UX improvement (enhances user interface without altering functionality)
  • Documentation update

Checklist

  • I have verified the accessibility of my changes.
  • I have tested all possible scenarios for this change.
  • I have updated theme.toml with a sane default for the feature.
  • I have made corresponding changes to the documentation:
    • Updated config.toml comments.
    • Updated theme.toml comments.
    • Updated "Mastering tabi" post in English.
    • (Optional) Updated "Mastering tabi" post in Spanish.
    • (Optional) Updated "Mastering tabi" post in Catalan.

@welpo welpo added the enhancement New feature or request label Nov 24, 2023
@welpo welpo changed the title ✨ feat(theme-switcher): respect theme_default when JS is enabled ✨ feat(theme-switcher)!: respect theme_default when JS is enabled Nov 24, 2023
@welpo welpo merged commit bf31f7f into main Nov 24, 2023
@welpo welpo deleted the feat/follow-default_theme-with-js branch November 24, 2023 23:08
Smtbook pushed a commit to Smtbook/zola-theme-tabi that referenced this pull request Feb 29, 2024
…elpo#224)

BREAKING CHANGE: changes the behaviour of `theme_default`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

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