Skip to content

Commit

Permalink
fix colors in infoview
Browse files Browse the repository at this point in the history
  • Loading branch information
abentkamp committed Jul 29, 2024
1 parent e718100 commit 3867782
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion demo/src/LeanMonaco.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function LeanMonacoComponent({options} : {options: LeanMonacoOptions}) {
;(async () => {
await leanMonaco.start(options)
leanMonaco.setInfoviewElement(infoviewRef.current!)
await leanMonacoEditor.start(codeviewRef.current!, `/project/test${Math.random()}.lean`, '#check Nat')
await leanMonacoEditor.start(codeviewRef.current!, `/project/test.lean`, '#check Nat')
})()

return () => {
Expand Down
9 changes: 4 additions & 5 deletions src/infowebview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,13 @@ export class IFrameInfoWebviewFactory implements InfoWebviewFactory {

private updateCssVars() {
const theme = this.themeService.getColorTheme();
const vscodeColors = ((colorUtils as any).getColorRegistry().getColors() as Array<{id:string}>).reduce<string>((colors, entry) => {
const documentStyle = this.iframe.contentDocument?.documentElement.style;
for (const entry of ((colorUtils as any).getColorRegistry().getColors() as Array<{id:string}>)) {
const color = theme.getColor(entry.id);
if (color) {
colors = colors + '--vscode-' + entry.id.replace('.', '-') + ': ' + color.toString() + "; ";
documentStyle?.setProperty('--vscode-' + entry.id.replace('.', '-'), color.toString());
}
return colors
}, '');
this.iframe.contentDocument?.documentElement.setAttribute('style', vscodeColors)
}
this.iframe.contentDocument?.documentElement.setAttribute('class', this.apiThemeClassName(theme))
}

Expand Down
1 change: 1 addition & 0 deletions src/leanmonaco.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ export class LeanMonaco {
"configuration": "./language-configuration.json"
}
],
colors: packageJson.contributes.colors as any,
"grammars": [
{
"language": "lean4",
Expand Down

0 comments on commit 3867782

Please sign in to comment.