Added invisible element to hack theme initialization.

This commit is contained in:
donfiguerres 2021-05-26 01:41:34 +08:00
parent 4254d03876
commit b754a9ce85
5 changed files with 18 additions and 5 deletions

View file

@ -22,11 +22,11 @@ function useSystemTheme() {
}
function initializeColorScheme() {
// We're using the themeSelector attributes as a 'hack' for setting up the
// We're using the themeInitialization attributes as a 'hack' for setting up the
// default color scheme becauase we don't want to complicate this further by
// creating custom javascript output in Hugo.
themeSelector = document.getElementById("themeSelector");
defaultColorScheme = themeSelector.getAttribute('default-theme');
themeInitialization = document.getElementById("themeInitialization");
defaultColorScheme = themeInitialization.getAttribute('default-theme');
// If the user has already selected a preferred theme then use that instead
// of the default theme. Also, the default theme gets loaded to localStorage
// on the first visit.