diff --git a/src/renderer/src/components/Preview/__tests__/__snapshots__/MermaidPreview.test.tsx.snap b/src/renderer/src/components/Preview/__tests__/__snapshots__/MermaidPreview.test.tsx.snap
index 01e98a63cd..1f87a151a8 100644
--- a/src/renderer/src/components/Preview/__tests__/__snapshots__/MermaidPreview.test.tsx.snap
+++ b/src/renderer/src/components/Preview/__tests__/__snapshots__/MermaidPreview.test.tsx.snap
@@ -2,10 +2,9 @@
exports[`MermaidPreview > basic rendering > should match snapshot 1`] = `
.c0 {
- overflow: auto;
- position: relative;
- width: 100%;
- height: 100%;
+ --shadow-host-background-color: transparent;
+ --shadow-host-border: unset;
+ --shadow-host-border-radius: unset;
}
diff --git a/src/renderer/src/components/Preview/__tests__/__snapshots__/PlantUmlPreview.test.tsx.snap b/src/renderer/src/components/Preview/__tests__/__snapshots__/PlantUmlPreview.test.tsx.snap
index 34d7840cb4..eb398f4cf5 100644
--- a/src/renderer/src/components/Preview/__tests__/__snapshots__/PlantUmlPreview.test.tsx.snap
+++ b/src/renderer/src/components/Preview/__tests__/__snapshots__/PlantUmlPreview.test.tsx.snap
@@ -1,6 +1,12 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`PlantUmlPreview > basic rendering > should match snapshot 1`] = `
+.c0 {
+ --shadow-host-background-color: white;
+ --shadow-host-border: 0.5px solid var(--color-code-background);
+ --shadow-host-border-radius: 8px;
+}
+
basic rendering > should match snapshot 1`] = `
data-testid="preview-content"
>
diff --git a/src/renderer/src/components/Preview/__tests__/__snapshots__/SvgPreview.test.tsx.snap b/src/renderer/src/components/Preview/__tests__/__snapshots__/SvgPreview.test.tsx.snap
index 00ee51b0e6..b96c8def5d 100644
--- a/src/renderer/src/components/Preview/__tests__/__snapshots__/SvgPreview.test.tsx.snap
+++ b/src/renderer/src/components/Preview/__tests__/__snapshots__/SvgPreview.test.tsx.snap
@@ -1,6 +1,12 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`SvgPreview > basic rendering > should match snapshot 1`] = `
+.c0 {
+ --shadow-host-background-color: white;
+ --shadow-host-border: 0.5px solid var(--color-code-background);
+ --shadow-host-border-radius: 8px;
+}
+
basic rendering > should match snapshot 1`] = `
data-testid="preview-content"
>
diff --git a/src/renderer/src/components/Preview/styles.ts b/src/renderer/src/components/Preview/styles.ts
index aa8718b34e..521b96e225 100644
--- a/src/renderer/src/components/Preview/styles.ts
+++ b/src/renderer/src/components/Preview/styles.ts
@@ -33,3 +33,15 @@ export const PreviewContainer = styled(Flex).attrs({ role: 'alert' })`
}
}
`
+
+export const ShadowWhiteContainer = styled.div`
+ --shadow-host-background-color: white;
+ --shadow-host-border: 0.5px solid var(--color-code-background);
+ --shadow-host-border-radius: 8px;
+`
+
+export const ShadowTransparentContainer = styled.div`
+ --shadow-host-background-color: transparent;
+ --shadow-host-border: unset;
+ --shadow-host-border-radius: unset;
+`
diff --git a/src/renderer/src/components/Preview/utils.ts b/src/renderer/src/components/Preview/utils.ts
index e400062911..476a3b913a 100644
--- a/src/renderer/src/components/Preview/utils.ts
+++ b/src/renderer/src/components/Preview/utils.ts
@@ -28,11 +28,15 @@ export function renderSvgInShadowHost(svgContent: string, hostElement: HTMLEleme
const style = document.createElement('style')
style.textContent = `
:host {
+ --shadow-host-background-color: white;
+ --shadow-host-border: 0.5px solid var(--color-code-background);
+ --shadow-host-border-radius: 8px;
+
+ background-color: var(--shadow-host-background-color);
+ border: var(--shadow-host-border);
+ border-radius: var(--shadow-host-border-radius);
padding: 1em;
- background-color: white;
overflow: hidden; /* Prevent scrollbars, as scaling is now handled */
- border: 0.5px solid var(--color-code-background);
- border-radius: 8px;
display: block;
position: relative;
width: 100%;