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

Remove in-line script from header #1004

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions assets/scripts/core/theme-scheme.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
let theme = localStorage.getItem('theme-scheme') || localStorage.getItem('darkmode:color-scheme') || 'light'
if (theme === 'system') {
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
theme = 'dark'
} else {
theme = 'light'
}
}
document.documentElement.setAttribute('data-theme', theme)
4 changes: 2 additions & 2 deletions exampleSite/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ go 1.21
replace github.com/hugo-toha/toha/v4 => ../

require (
github.com/hugo-toha/hugo-toha.github.io v0.0.0-20240510202502-b4192719c87f // indirect
github.com/hugo-toha/toha/v4 v4.5.0 // indirect
github.com/hugo-toha/hugo-toha.github.io v0.0.0-20241018183051-dd13c36f46b4 // indirect
github.com/hugo-toha/toha/v4 v4.7.0 // indirect
)
4 changes: 2 additions & 2 deletions exampleSite/go.sum
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
github.com/hugo-toha/hugo-toha.github.io v0.0.0-20240510202502-b4192719c87f h1:EpJlxR6ruHtcBIHLVlmfgpoPGAjpAvopGq8h1wscEwY=
github.com/hugo-toha/hugo-toha.github.io v0.0.0-20240510202502-b4192719c87f/go.mod h1:0gXAIE/H9B3kwsNvyqXXP0gTLCzi/DKwoIOz8Bb9j9c=
github.com/hugo-toha/hugo-toha.github.io v0.0.0-20241018183051-dd13c36f46b4 h1:Yc5SJ5NJx1xu3YO2gQZPeADXqhGdJgUGWiDxgEDuUrQ=
github.com/hugo-toha/hugo-toha.github.io v0.0.0-20241018183051-dd13c36f46b4/go.mod h1:3N7k1DSQGy5Zn5IVp5nQ3QJ/VWh5dSxXO6stUS7txrg=
Loading
Loading