diff --git a/src/themes/BaseTheme.ts b/src/themes/BaseTheme.ts index 3c346b8c..ba970073 100644 --- a/src/themes/BaseTheme.ts +++ b/src/themes/BaseTheme.ts @@ -1,4 +1,5 @@ // import {ThemeOptions} from "@mui/material/styles"; +import { shouldSkipGeneratingVar as defaultShouldSkipGeneratingVar } from "@mui/material/styles"; import { ImageColourSchemeSwitchType } from "../components/controls/ImageColourSchemeSwitch"; // Make additions to theme, so that anything can be available throughout the app @@ -20,6 +21,9 @@ declare module "@mui/material/styles" { const BaseThemeOptions /* : ThemeOptions */ = { cssVariables: { colorSchemeSelector: "class", + // `logos` holds raw image sources (e.g. SVG data URIs), not CSS values, so skip var generation for it. + shouldSkipGeneratingVar: (keys: string[]) => + keys[0] === "logos" || defaultShouldSkipGeneratingVar(keys), }, typography: { fontSize: 14, diff --git a/src/themes/DiamondDSTheme.ts b/src/themes/DiamondDSTheme.ts index 8545ca22..57dd67e3 100644 --- a/src/themes/DiamondDSTheme.ts +++ b/src/themes/DiamondDSTheme.ts @@ -24,7 +24,10 @@ import "../styles/diamondDS/DiamondDSTypography.css"; // Enables `theme.vars` typings for MUI CSS variable themes. import type {} from "@mui/material/themeCssVarsAugmentation"; -import { extendTheme } from "@mui/material/styles"; +import { + extendTheme, + shouldSkipGeneratingVar as defaultShouldSkipGeneratingVar, +} from "@mui/material/styles"; import type { CSSObject, Overlays, @@ -734,6 +737,10 @@ const DiamondDSTheme = extendTheme({ */ colorSchemeSelector: '[data-mode="%s"]', + // `logos` holds raw image sources (e.g. SVG data URIs), not CSS values, so skip var generation for it. + shouldSkipGeneratingVar: (keys) => + keys[0] === "logos" || defaultShouldSkipGeneratingVar(keys), + colorSchemes: { light: { palette: createDiamondPalette("light"),