瀏覽代碼

Merge pull request #4975 from sebdanielsson/automatic-theme-update

fix: Update color theme on system change
Timothy Jaeryang Baek 8 月之前
父節點
當前提交
f75908ebe3
共有 1 個文件被更改,包括 4 次插入0 次删除
  1. 4 0
      src/app.html

+ 4 - 0
src/app.html

@@ -22,6 +22,10 @@
 		<script>
 			// On page load or when changing themes, best to add inline in `head` to avoid FOUC
 			(() => {
+				if (!localStorage?.theme) {
+					localStorage.theme = 'system';
+				}
+
 				if (localStorage?.theme && localStorage?.theme.includes('oled')) {
 					document.documentElement.style.setProperty('--color-gray-800', '#101010');
 					document.documentElement.style.setProperty('--color-gray-850', '#050505');