Skip to content

Commit c28207a

Browse files
committed
wip: add setBodyBackgroundToThemeBackgroundColor
1 parent 71a8f9a commit c28207a

File tree

2 files changed

+61
-1
lines changed

2 files changed

+61
-1
lines changed

src/browser/pages/vscode.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,26 @@ try {
9595
console.error(error)
9696
}
9797

98+
export function setBodyBackgroundToThemeBackgroundColor(document: Document, localStorage: Storage) {
99+
const errorMsgPrefix = "[vscode]"
100+
101+
if (!document) {
102+
throw new Error(`${errorMsgPrefix} Could not set body background to theme background color. Document is undefined.`)
103+
}
104+
105+
if (!localStorage) {
106+
throw new Error(`${errorMsgPrefix} Could not set body background to theme background color. localStorage is undefined.`)
107+
}
108+
109+
const colorThemeData = localStorage.getItem("colorThemeData")
110+
111+
if (!colorThemeData) {
112+
throw new Error(`${errorMsgPrefix} Could not set body background to theme background color. Could not find colorThemeData in localStorage.`)
113+
}
114+
115+
return null
116+
}
117+
98118
try {
99119
document.body.style.background = JSON.parse(localStorage.getItem("colorThemeData")!).colorMap["editor.background"]
100120
} catch (error) {

0 commit comments

Comments
 (0)