add colored string for rst export
This commit is contained in:
@@ -549,6 +549,23 @@ Example usage
|
||||
r g b
|
||||
(or description color)))
|
||||
(format "No Color RGB for %s" color))))
|
||||
;; text :raw-html:`<span style="color:red">foo</span>` baz
|
||||
;; need in Sphinx conf.py rst_prolog = """
|
||||
;; .. role:: raw-html(raw)
|
||||
;; :format: html
|
||||
;; """
|
||||
((eq backend 'rst)
|
||||
(let ((rgb (color-name-to-rgb color))
|
||||
r g b)
|
||||
(if rgb
|
||||
(progn
|
||||
(setq r (truncate (* 255 (nth 0 rgb))))
|
||||
(setq g (truncate (* 255 (nth 1 rgb))))
|
||||
(setq b (truncate (* 255 (nth 2 rgb))))
|
||||
(format ":raw-html:`<span style=\"color: rgb(%s,%s,%s)\">%s</span>`"
|
||||
r g b
|
||||
(or description color)))
|
||||
(format "No Color RGB for %s" color))))
|
||||
((eq backend 'latex)
|
||||
(let ((rgb (color-name-to-rgb color)))
|
||||
(if rgb
|
||||
|
||||
Reference in New Issue
Block a user