Function: pdf-util-face-colors
pdf-util-face-colors is a natively compiled function defined in
pdf-util.el.
Signature
(pdf-util-face-colors FACE &optional DARK-P)
Documentation
Return both colors of FACE as a cons.
Look also in inherited faces. If DARK-P is non-nil, return dark colors, otherwise light.
Source Code
;; Defined in /nix/store/63h5z2vmzn0mfavcxi2idi23g5xcgkbl-emacs-packages-deps/share/emacs/site-lisp/elpa/pdf-tools-20260102.1101/pdf-util.el
(defun pdf-util-face-colors (face &optional dark-p)
"Return both colors of FACE as a cons.
Look also in inherited faces. If DARK-P is non-nil, return dark
colors, otherwise light."
(let* ((bg (if dark-p 'dark 'light))
(spec (list (get face 'face-defface-spec)
(get face 'theme-face)
(get face 'customized-face)))
(cached (gethash face pdf-util--face-colors-cache)))
(cl-destructuring-bind (&optional cspec color-alist)
cached
(or (and color-alist
(equal cspec spec)
(cdr (assq bg color-alist)))
(let* ((this-bg (frame-parameter nil 'background-mode))
(frame-background-mode bg)
(f (and (not (eq bg this-bg))
(x-create-frame-with-faces '((visibility . nil))))))
(with-selected-frame (or f (selected-frame))
(unwind-protect
(let ((colors
(cons (face-attribute face :foreground nil 'default)
(face-attribute face :background nil 'default))))
(puthash face `(,(mapcar #'copy-sequence spec)
((,bg . ,colors) ,@color-alist))
pdf-util--face-colors-cache)
colors)
(when (and f (frame-live-p f))
(delete-frame f)))))))))