Skip to content

Commit 6907db3

Browse files
committed
perf: css variable 从 :root 迁移到 body
1 parent e3e3d86 commit 6907db3

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "background",
33
"displayName": "background",
44
"description": "Bring background images to your vscode",
5-
"version": "2.0.8-alpha.3",
5+
"version": "2.0.8-alpha.5",
66
"scripts": {
77
"vscode:prepublish": "npm run compile",
88
"vscode:uninstall": "node ./out/uninstall",

src/background/PatchGenerator/PatchGenerator.fullscreen.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ function getNextImg() {
7373
}
7474
7575
function setNextImg() {
76-
document.documentElement.style.setProperty(cssvariable, 'url(' + getNextImg() + ')');
76+
document.body.style.setProperty(cssvariable, 'url(' + getNextImg() + ')');
7777
}
7878
7979
if (interval > 0) {

src/background/PatchGenerator/PatchGenerator.theme.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ export class ThemePatchGenerator extends WithoutImagesPatchGenerator {
1212
protected getStyle(): string {
1313
return css`
1414
// 浅色主题(默认)
15-
:root {
15+
body {
1616
// 不使用混合模式
1717
${ThemePatchGenerator.cssMixBlendMode}: unset;
1818
}
1919
20-
// 深色主题 (覆盖)
21-
:root:has(body > .monaco-workbench.vs-dark) {
20+
// 深色主题 (覆盖),避免使用 :root
21+
body:has(> .monaco-workbench.vs-dark) {
2222
// 使用混合模式
2323
${ThemePatchGenerator.cssMixBlendMode}: screen;
2424
}

0 commit comments

Comments
 (0)