Function: ghostel--face-hex-color
ghostel--face-hex-color is a natively compiled function defined in
ghostel-faces.el.
Signature
(ghostel--face-hex-color FACE ATTR)
Documentation
Extract hex color string from FACE's ATTR (:foreground or :background).
Falls back to white (for :foreground) or black (for :background).
Source Code
;; Defined in /nix/store/1252krff0gb2kisjcpp45m50cpdskfrl-emacs-packages-deps/share/emacs/site-lisp/ghostel-faces.el
;;; Face utilities
(defun ghostel--face-hex-color (face attr)
"Extract hex color string from FACE's ATTR (:foreground or :background).
Falls back to white (for :foreground) or black (for :background)."
(or (let ((color (face-attribute face attr nil 'default)))
(when (and (stringp color)
(not (member color '("unspecified"
"unspecified-fg"
"unspecified-bg"))))
(let ((rgb (color-values color)))
(if rgb
(apply #'format "#%02x%02x%02x"
(mapcar (lambda (c) (ash c -8)) rgb))
;; Batch mode / TTY: color-values returns nil without a
;; display. If the color is already "#RRGGBB", use it.
(and (string-prefix-p "#" color) (= (length color) 7)
color)))))
(if (eq attr :foreground) "#ffffff" "#000000")))