Skip to content

Commit 3867782

Browse files
committed
fix colors in infoview
1 parent e718100 commit 3867782

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

demo/src/LeanMonaco.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ function LeanMonacoComponent({options} : {options: LeanMonacoOptions}) {
1212
;(async () => {
1313
await leanMonaco.start(options)
1414
leanMonaco.setInfoviewElement(infoviewRef.current!)
15-
await leanMonacoEditor.start(codeviewRef.current!, `/project/test${Math.random()}.lean`, '#check Nat')
15+
await leanMonacoEditor.start(codeviewRef.current!, `/project/test.lean`, '#check Nat')
1616
})()
1717

1818
return () => {

src/infowebview.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,13 @@ export class IFrameInfoWebviewFactory implements InfoWebviewFactory {
7979

8080
private updateCssVars() {
8181
const theme = this.themeService.getColorTheme();
82-
const vscodeColors = ((colorUtils as any).getColorRegistry().getColors() as Array<{id:string}>).reduce<string>((colors, entry) => {
82+
const documentStyle = this.iframe.contentDocument?.documentElement.style;
83+
for (const entry of ((colorUtils as any).getColorRegistry().getColors() as Array<{id:string}>)) {
8384
const color = theme.getColor(entry.id);
8485
if (color) {
85-
colors = colors + '--vscode-' + entry.id.replace('.', '-') + ': ' + color.toString() + "; ";
86+
documentStyle?.setProperty('--vscode-' + entry.id.replace('.', '-'), color.toString());
8687
}
87-
return colors
88-
}, '');
89-
this.iframe.contentDocument?.documentElement.setAttribute('style', vscodeColors)
88+
}
9089
this.iframe.contentDocument?.documentElement.setAttribute('class', this.apiThemeClassName(theme))
9190
}
9291

src/leanmonaco.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ export class LeanMonaco {
200200
"configuration": "./language-configuration.json"
201201
}
202202
],
203+
colors: packageJson.contributes.colors as any,
203204
"grammars": [
204205
{
205206
"language": "lean4",

0 commit comments

Comments
 (0)