File tree Expand file tree Collapse file tree 2 files changed +61
-1
lines changed Expand file tree Collapse file tree 2 files changed +61
-1
lines changed Original file line number Diff line number Diff line change 95
95
console . error ( error )
96
96
}
97
97
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
+
98
118
try {
99
119
document . body . style . background = JSON . parse ( localStorage . getItem ( "colorThemeData" ) ! ) . colorMap [ "editor.background" ]
100
120
} catch ( error ) {
You can’t perform that action at this time.
0 commit comments