forked from mirrors/org-mode
org-latex-preview: Simplify color formatting
* lisp/org-latex-preview.el (org-latex-preview--format-color, org-latex-preview--normalize-color): Use three decimal places, and remove the now-obsolete `org-latex-preview--normalize-color'. * lisp/org-compat.el (org-normalize-color): With the removal of the `org-latex-preview--normalize-color' alias, mark `org-normalize-color' as obsolete.
This commit is contained in:
parent
b37062d4a8
commit
40d8b3acea
|
@ -704,8 +704,6 @@ This constant, for example, makes the below code not err:
|
|||
'org-latex-color-format 'org-latex-preview--format-color "9.7")
|
||||
(define-obsolete-function-alias
|
||||
'org-latex-color 'org-latex-preview--attr-color "9.7")
|
||||
(define-obsolete-function-alias
|
||||
'org-normalize-color 'org-latex-preview--normalize-color "9.7")
|
||||
;; MathML related functions from org-latex-preview.el
|
||||
(define-obsolete-variable-alias
|
||||
'org-latex-to-mathml-jar-file 'org-mathml-converter-jar-file "9.7")
|
||||
|
@ -760,6 +758,12 @@ This constant, for example, makes the below code not err:
|
|||
(make-obsolete
|
||||
'org-dvipng-color-format "to be removed" "9.7")
|
||||
|
||||
;; FIXME: Unused; obsoleted; to be removed.
|
||||
(defun org-normalize-color (value)
|
||||
"Return string to be used as color value for an RGB component."
|
||||
(format "%g" (/ value 65535.0)))
|
||||
(make-obsolete 'org-normalize-color "to be removed" "9.7")
|
||||
|
||||
;; FIXME: Unused; obsoleted; to be removed.
|
||||
(defcustom org-preview-latex-image-directory "ltximg/"
|
||||
"Path to store latex preview images.
|
||||
|
|
|
@ -2397,14 +2397,11 @@ used it can be worth storing the results to avoid re-computing.")
|
|||
"Convert COLOR-NAME to a RGB color value."
|
||||
(or (alist-get color-name org-latex-preview--format-color-cache nil nil #'equal)
|
||||
(cdar (push (cons color-name
|
||||
(apply #'format "%s,%s,%s"
|
||||
(mapcar 'org-latex-preview--normalize-color
|
||||
(color-values color-name))))
|
||||
(apply #'format "%.3f,%.3f,%.3f"
|
||||
(mapcar
|
||||
(lambda (v) (/ v 65535.0))
|
||||
(color-values color-name))))
|
||||
org-latex-preview--format-color-cache))))
|
||||
|
||||
(defun org-latex-preview--normalize-color (value)
|
||||
"Return string to be used as color value for an RGB component."
|
||||
(format "%g" (/ value 65535.0)))
|
||||
|
||||
(provide 'org-latex-preview)
|
||||
;;; org-latex-preview.el ends here
|
||||
|
|
Loading…
Reference in New Issue