Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

Fix `dashboard.backgroundColor: transparent` breaking dashboard PDF export (#65847)

Mahatthana (Kelvin) Nomsawadi2b69c463dd67
diff --git a/frontend/src/metabase/visualizations/lib/save-dashboard-pdf.ts b/frontend/src/metabase/visualizations/lib/save-dashboard-pdf.ts
index 4852a8eeff5..303f6b62650 100644
--- a/frontend/src/metabase/visualizations/lib/save-dashboard-pdf.ts
+++ b/frontend/src/metabase/visualizations/lib/save-dashboard-pdf.ts
@@ -217,11 +217,13 @@ export const saveDashboardPdf = async ({
headerHeight + parametersHeight + (includeBranding ? brandingHeight : 0);
const contentHeight = gridNode.offsetHeight + verticalOffset;
- let backgroundColor = Color(
- getComputedStyle(document.documentElement)
- .getPropertyValue("--mb-color-bg-dashboard")
- .trim(),
- ).hex();
+ const rawBackgroundColor = getComputedStyle(document.documentElement)
+ .getPropertyValue("--mb-color-bg-dashboard")
+ .trim();
+ let backgroundColor =
+ rawBackgroundColor === "transparent"
+ ? "transparent"
+ : Color(rawBackgroundColor).hex();
if (!(await isValidColor(backgroundColor))) {
backgroundColor = "white"; // Fallback to white if the color is invalid