diff --git a/lisp/net/shr.el b/lisp/net/shr.el index 81c3fb4aa52..1dff129b9dc 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el @@ -1180,8 +1180,24 @@ Return a string with image data." ;; so glitches may occur during this transformation. (shr-dom-to-xml (libxml-parse-xml-region (point) (point-max))))) + ;; SVG images often do not have a specified foreground/background + ;; color, so wrap them in styles. + (when (eq content-type 'image/svg+xml) + (setq data (svg--wrap-svg data))) (list data content-type))) +(defun svg--wrap-svg (data) + "Add a default foreground colour to SVG images." + (with-temp-buffer + (insert "" + "") + (buffer-string))) + (defun shr-image-displayer (content-function) "Return a function to display an image. CONTENT-FUNCTION is a function to retrieve an image for a cid url that