Commit 5a0ab88c authored by Lars Ingebrigtsen's avatar Lars Ingebrigtsen
Browse files

Add default foreground colours to SVG images

* lisp/net/shr.el (svg--wrap-svg): Add a default foreground colour
to SVG images (bug#37159).  This helps with images like the ones
in that
specify no foreground or background colours.
(shr-parse-image-data): Use it.
parent 568f1488
Pipeline #3129 passed with stage
in 78 minutes and 17 seconds
......@@ -1180,8 +1180,24 @@ Return a string with image data."
;; so glitches may occur during this transformation.
(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."
(insert "<svg xmlns:xlink=\"\" "
"xmlns:xi=\"\" "
"style=\"color: "
(face-foreground 'default) ";\">"
"<xi:include href=\"data:image/svg+xml;base64,"
(base64-encode-string data t)
(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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment