From a22d7a39540600508141db4e20fd9c685ba4b610 Mon Sep 17 00:00:00 2001 From: Daniel Weschke Date: Sun, 25 Jan 2026 18:59:55 +0100 Subject: [PATCH] add colored string for rst export --- lisp/my/my.el | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lisp/my/my.el b/lisp/my/my.el index 6ba908cb..8e8a5ea6 100644 --- a/lisp/my/my.el +++ b/lisp/my/my.el @@ -549,6 +549,23 @@ Example usage r g b (or description color))) (format "No Color RGB for %s" 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) + (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)))) ((eq backend 'latex) (let ((rgb (color-name-to-rgb color))) (if rgb