Skip to content

Commit

Permalink
🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
nanarino committed Dec 31, 2023
1 parent 924f595 commit fe316d7
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 11 deletions.
1 change: 1 addition & 0 deletions assets/index-0ed2946a.css

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion assets/index-182f3b79.css

This file was deleted.

5 changes: 0 additions & 5 deletions assets/index-b1a192c2.js

This file was deleted.

25 changes: 25 additions & 0 deletions assets/index-cdd683cd.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script src="/vue-image-uploader/theme.js"></script>
<title>vue-image-uploader</title>
<script type="module" crossorigin src="/vue-image-uploader/assets/index-b1a192c2.js"></script>
<link rel="stylesheet" href="/vue-image-uploader/assets/index-182f3b79.css">
<script type="module" crossorigin src="/vue-image-uploader/assets/index-cdd683cd.js"></script>
<link rel="stylesheet" href="/vue-image-uploader/assets/index-0ed2946a.css">
</head>
<body>
<div id="app"></div>
Expand Down
12 changes: 9 additions & 3 deletions theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
* 获取系统是否暗黑模式
* 这个代码要放在body之前 否则可能会有闪烁
*/
document.documentElement.dataset["theme"] = ["dark", "light"][
+!window.matchMedia?.("(prefers-color-scheme: dark)")?.matches
];
Object.defineProperty(window, "theme", {
get: () =>
localStorage.getItem("theme") ??
["dark", "light"][
+!window.matchMedia?.("(prefers-color-scheme: dark)")
?.matches
],
});
document.documentElement.dataset["theme"] = window.theme;

0 comments on commit fe316d7

Please sign in to comment.