Merge pull request #301 from eltociear/patch-1

Fix typo in theme-switcher.js
This commit is contained in:
Lucas Larroche 2023-01-28 12:45:37 +07:00 committed by GitHub
commit cf887066f4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -14,7 +14,7 @@ export const themeSwitcher = {
dark: '<i>Turn off dark mode</i>',
},
buttonsTarget: '.theme-switcher',
localStorageKey: 'picoPreferedColorScheme',
localStorageKey: 'picoPreferredColorScheme',
// Init
init() {
@ -32,8 +32,8 @@ export const themeSwitcher = {
return this._scheme;
},
// Prefered color scheme
get preferedColorScheme() {
// Preferred color scheme
get preferredColorScheme() {
return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
},
@ -57,7 +57,7 @@ export const themeSwitcher = {
// Set scheme
set scheme(scheme) {
if (scheme == 'auto') {
this.preferedColorScheme == 'dark' ? this._scheme = 'dark' : this._scheme = 'light';
this.preferredColorScheme == 'dark' ? this._scheme = 'dark' : this._scheme = 'light';
}
else if (scheme == 'dark' || scheme == 'light') {
this._scheme = scheme;