fix: Regression - invert SVGs in Dark Mode (#10695)
* initial implementation * lint * removed separate getThemeFilterValue function from renderElement * removed BinaryFileData changes * filter instead of css filter
This commit is contained in:
@@ -3,11 +3,13 @@ import {
|
||||
MAX_DECIMALS_FOR_SVG_EXPORT,
|
||||
SVG_NS,
|
||||
THEME,
|
||||
DARK_THEME_FILTER,
|
||||
getFontFamilyString,
|
||||
isRTL,
|
||||
isTestEnv,
|
||||
getVerticalOffset,
|
||||
applyDarkModeFilter,
|
||||
MIME_TYPES,
|
||||
} from "@excalidraw/common";
|
||||
import { normalizeLink, toValidURL } from "@excalidraw/common";
|
||||
import { hashString } from "@excalidraw/element";
|
||||
@@ -520,6 +522,13 @@ const renderElementToSvg = (
|
||||
|
||||
const g = svgRoot.ownerDocument.createElementNS(SVG_NS, "g");
|
||||
|
||||
if (
|
||||
renderConfig.theme === THEME.DARK &&
|
||||
fileData.mimeType === MIME_TYPES.svg
|
||||
) {
|
||||
g.setAttribute("filter", DARK_THEME_FILTER);
|
||||
}
|
||||
|
||||
if (element.crop) {
|
||||
const mask = svgRoot.ownerDocument.createElementNS(SVG_NS, "mask");
|
||||
mask.setAttribute("id", `mask-image-crop-${element.id}`);
|
||||
|
||||
Reference in New Issue
Block a user