fix(live): don't pass backgroundColor to domToBlob

modern-screenshot force-sets `background-color: X !important` on the root
clone's inline style when backgroundColor is passed, clobbering the
element's real background and rendering every captured card with the page
body color. Omit the option so the canvas stays transparent and the
element's own background renders into the foreignObject.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Paul Bakaus
2026-04-22 02:05:22 -07:00
co-authored by Claude Opus 4.7
parent c7ee722472
commit 99494348bf
12 changed files with 60 additions and 12 deletions
@@ -1787,9 +1787,13 @@
try {
const ms = await loadModernScreenshot();
const fontCssText = await collectFontCssText();
// Deliberately no `backgroundColor` option. modern-screenshot force-sets
// `background-color: X !important` on the root clone's inline style when
// that option is passed, clobbering the element's real background. Leave
// the canvas transparent; the element's own background renders into the
// foreignObject.
return await ms.domToBlob(el, {
scale: Math.min(window.devicePixelRatio || 1, 2),
backgroundColor: getComputedStyle(document.body).backgroundColor || '#ffffff',
font: fontCssText ? { cssText: fontCssText } : undefined,
});
} finally {