Skip to content

Commit

Permalink
fix: background depending on theme style
Browse files Browse the repository at this point in the history
  • Loading branch information
peterhnm committed Aug 1, 2023
1 parent fe714b4 commit 5cc1a5a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
18 changes: 17 additions & 1 deletion apps/miranum-bpmn-modeler-webview/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import TokenSimulationModule from "bpmn-js-token-simulation";
import ElementTemplateChooserModule from "@bpmn-io/element-template-chooser";
import miragonProviderModule from "./app/PropertieProvider/provider";
// css
import "./styles.css";
import "./styles/styles.css";
import "camunda-bpmn-js/dist/assets/camunda-platform-modeler.css";
import "camunda-bpmn-js/dist/assets/camunda-cloud-modeler.css";
import "bpmn-js-token-simulation/assets/css/bpmn-js-token-simulation.css";
Expand All @@ -33,6 +33,8 @@ const updateXML = asyncDebounce(openXML, 100);
//
// Logic
//
// Set the overall style (light or dark)
setThemeStyle();

// Listen to messages from the backend/extension
setupListeners();
Expand Down Expand Up @@ -360,6 +362,20 @@ function getTheme(): { defaultFillColor: string; defaultStrokeColor: string } {
};
}

/**
* Depending on the theme style of VS Code, the background of the modeler must be set.
*/
function setThemeStyle(): void {
switch (document.body.className) {
case "vscode-dark": {
const style = document.createElement("style");
style.innerHTML = ":root .layer-djs-grid { filter: invert(1); }";
document.head.appendChild(style);
break;
}
}
}

/**
* A promise that will resolve if initialized() is called.
*/
Expand Down
7 changes: 0 additions & 7 deletions apps/miranum-bpmn-modeler-webview/src/styles/theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,6 @@
--token-simulation-grey-darken-30: var(--vscode-editor-foreground);
}

/**
* Background
*/
:root .layer-djs-grid {
filter: invert(1);
}

/**
* Diagram JS
*/
Expand Down

0 comments on commit 5cc1a5a

Please sign in to comment.