Function: htmlize-face-color-internal

htmlize-face-color-internal is a byte-compiled function defined in htmlize.el.

Signature

(htmlize-face-color-internal FACE FG)

Source Code

;; Defined in ~/.emacs.d/elpa/htmlize-20250724.1703/htmlize.el
;;; Face handling.

(defun htmlize-face-color-internal (face fg)
  ;; Used only under GNU Emacs.  Return the color of FACE, but don't
  ;; return "unspecified-fg" or "unspecified-bg".  If the face is
  ;; `default' and the color is unspecified, look up the color in
  ;; frame parameters.
  (let* ((function (if fg #'face-foreground #'face-background))
         (color (funcall function face nil t)))
    (when (and (eq face 'default) (null color))
      (setq color (cdr (assq (if fg 'foreground-color 'background-color)
                             (frame-parameters)))))
    (when (or (eq color 'unspecified)
              (equal color "unspecified-fg")
              (equal color "unspecified-bg"))
      (setq color nil))
    (when (and (eq face 'default)
               (null color))
      ;; Assuming black on white doesn't seem right, but I can't think
      ;; of anything better to do.
      (setq color (if fg "black" "white")))
    color))