diff --git a/editor/src/node_graph_executor/runtime.rs b/editor/src/node_graph_executor/runtime.rs
index d799b3817d..d0ef87392f 100644
--- a/editor/src/node_graph_executor/runtime.rs
+++ b/editor/src/node_graph_executor/runtime.rs
@@ -491,8 +491,8 @@ impl NodeRuntime {
let mut render = SvgRender::new();
graphic.render_svg(&mut render, &render_params);
- // And give the SVG a viewbox and outer wrapper tag
- render.format_svg(bounds[0], bounds[1]);
+ // And give the SVG a viewbox and outer wrapper tag as isolation group to prevent blending against the background checker
+ render.format_svg_with_attributes(bounds[0], bounds[1], |attributes| attributes.push("style", "isolation: isolate;"));
render.svg
};
diff --git a/node-graph/libraries/rendering/src/renderer.rs b/node-graph/libraries/rendering/src/renderer.rs
index 25e4dee031..ce5fd300e9 100644
--- a/node-graph/libraries/rendering/src/renderer.rs
+++ b/node-graph/libraries/rendering/src/renderer.rs
@@ -93,10 +93,20 @@ impl SvgRender {
/// Add an outer `` tag with a `viewBox` and the ``
pub fn format_svg(&mut self, bounds_min: DVec2, bounds_max: DVec2) {
+ self.format_svg_with_attributes(bounds_min, bounds_max, |_| {});
+ }
+
+ /// Add an outer `` tag with a `viewBox`, the ``, and the provided attributes.
+ pub fn format_svg_with_attributes(&mut self, bounds_min: DVec2, bounds_max: DVec2, attributes: impl FnOnce(&mut SvgRenderAttrs)) {
let (x, y) = bounds_min.into();
let (size_x, size_y) = (bounds_max - bounds_min).into();
+
+ let mut attr_render = SvgRender::new();
+ attributes(&mut SvgRenderAttrs(&mut attr_render));
+ let attributes_str = attr_render.svg.to_svg_string();
+
let svg_header = format!(
- r#"