diff --git a/lisp/my/my.el b/lisp/my/my.el index cdaf0496..7616fbf7 100644 --- a/lisp/my/my.el +++ b/lisp/my/my.el @@ -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 "%s" - r g b - (or description color))) - (format "No Color RGB for %s" color)))) + (format "%s" + (truncate (* 255 (nth 0 rgb))) + (truncate (* 255 (nth 1 rgb))) + (truncate (* 255 (nth 2 rgb))) + (or description color)) + (format "%s" color (or description color))))) ;; text :raw-html:`foo` 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:`%s`" - r g b - (or description color))) - (format "No Color RGB for %s" color)))) + (format ":raw-html:`%s`" + (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)))) + (format "\\textcolor[rgb]{%s,%s,%s}{%s}" + (nth 0 rgb) (nth 1 rgb) (nth 2 rgb) + (or description color)) + (format "\\textcolor{%s}{%s}" color (or description color))))) ))) (defun my-org-link-color (limit) "Helper function for colored text in buffer.