Function: eca-safe-face-background

eca-safe-face-background is a natively compiled function defined in eca-util.el.

Signature

(eca-safe-face-background FACE &optional FRAME INHERIT)

Documentation

Return background of FACE on FRAME, treating TTY sentinels as nil.

INHERIT is passed through to face-background. On non-graphic frames face-background returns the literal strings
"unspecified-bg" / "unspecified-fg" instead of nil, which
breaks callers that feed the result to color-name-to-rgb (e.g. color-lighten-name, color-darken-name). This wrapper maps those sentinels back to nil so callers can short-circuit with when-let* and friends.

Source Code

;; Defined in /nix/store/jklqzw6pzz6j4jrbv8wy0iwgi7jlrbld-emacs-packages-deps/share/emacs/site-lisp/elpa/eca-20260928.1827/eca-util.el
(defun eca-safe-face-background (face &optional frame inherit)
  "Return background of FACE on FRAME, treating TTY sentinels as nil.
INHERIT is passed through to `face-background'.  On non-graphic
frames `face-background' returns the literal strings
\"unspecified-bg\" / \"unspecified-fg\" instead of nil, which
breaks callers that feed the result to `color-name-to-rgb' (e.g.
`color-lighten-name', `color-darken-name').  This wrapper maps
those sentinels back to nil so callers can short-circuit with
`when-let*' and friends."
  (let ((bg (face-background face frame inherit)))
    (unless (member bg '("unspecified-bg" "unspecified-fg"))
      bg)))