File tree Expand file tree Collapse file tree 1 file changed +13
-10
lines changed
scripts/ColorSchemeSwitchThreeStates/view Expand file tree Collapse file tree 1 file changed +13
-10
lines changed Original file line number Diff line number Diff line change 44 $iconClasses = $iconClasses ?? ' size-4' ;
55@endphp
66
7- <button
8- x-data =" {
9- refresh() {
10- this.isSystem = localStorage.getItem('colorScheme') === '{{ SchemeTypeEnum:: SYSTEM } } ';
11- this.isDark = localStorage.getItem('colorScheme') === '{{ SchemeTypeEnum:: DARK } } ';
12- this.isLight = localStorage.getItem('colorScheme') === '{{ SchemeTypeEnum:: LIGHT } } ';
13- }
14- }"
15- x-init =" refresh()"
7+ <button x-data =" {
8+ refresh() {
9+ this.isSystem = localStorage.getItem('colorScheme') === '{{ SchemeTypeEnum:: SYSTEM } } ';
10+ this.isDark = localStorage.getItem('colorScheme') === '{{ SchemeTypeEnum:: DARK } } ';
11+ this.isLight = localStorage.getItem('colorScheme') === '{{ SchemeTypeEnum:: LIGHT } } ';
12+ },
13+ }"
14+ x-init =" refresh(); (function () {
15+ document.addEventListener('colorSchemeChanged', function() {
16+ refresh();
17+ });
18+ })()"
1619 {{--
1720 .switchColorScheme() is defined in switch-script.js
1821 --}}
1922 @click =" window.inlineScripts.switchColorScheme(); refresh()"
20- @keydown .window =" refresh()"
23+ @color -scheme-changed.document =" refresh()"
2124 title =" Color scheme switcher"
2225>
2326 <span class =" hidden"
You can’t perform that action at this time.
0 commit comments