fix color link
This commit is contained in:
+17
-24
@@ -540,43 +540,36 @@ Example usage
|
||||
"if link description is empty use color as description.
|
||||
[[color:COLOR][DESCRIPTION]]"
|
||||
(cond
|
||||
((eq backend 'html)
|
||||
(let ((rgb (color-name-to-rgb color))
|
||||
r g b)
|
||||
((or (eq backend 'html) (eq backend 'article-html))
|
||||
(let ((rgb (color-name-to-rgb color)))
|
||||
(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 "<span style=\"color: rgb(%s,%s,%s)\">%s</span>"
|
||||
r g b
|
||||
(or description color)))
|
||||
(format "No Color RGB for %s" color))))
|
||||
(format "<span style=\"color: rgb(%d,%d,%d)\">%s</span>"
|
||||
(truncate (* 255 (nth 0 rgb)))
|
||||
(truncate (* 255 (nth 1 rgb)))
|
||||
(truncate (* 255 (nth 2 rgb)))
|
||||
(or description color))
|
||||
(format "<span style=\"color: %s\">%s</span>" color (or description 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)
|
||||
(let ((rgb (color-name-to-rgb color)))
|
||||
(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))))
|
||||
(format ":raw-html:`<span style=\"color: rgb(%d,%d,%d)\">%s</span>`"
|
||||
(truncate (* 255 (nth 0 rgb)))
|
||||
(truncate (* 255 (nth 1 rgb)))
|
||||
(truncate (* 255 (nth 2 rgb)))
|
||||
(or description color))
|
||||
(or description color))))
|
||||
((eq backend 'latex)
|
||||
(let ((rgb (color-name-to-rgb color)))
|
||||
(if rgb
|
||||
(progn
|
||||
(format "\\textcolor[rgb]{%s,%s,%s}{%s}"
|
||||
(nth 0 rgb) (nth 1 rgb) (nth 2 rgb)
|
||||
(or description color)))
|
||||
(format "No Color RGB for %s" color))))
|
||||
(or description color))
|
||||
(format "\\textcolor{%s}{%s}" color (or description color)))))
|
||||
)))
|
||||
(defun my-org-link-color (limit)
|
||||
"Helper function for colored text in buffer.
|
||||
|
||||
Reference in New Issue
Block a user