Function: faces--string-with-color

faces--string-with-color is a byte-compiled function defined in faces.el.gz.

Signature

(faces--string-with-color STRING COLOR &optional FOREGROUND FACE)

Documentation

Return a copy of STRING with face attributes for COLOR.

Set the :background or :foreground attribute to COLOR, depending on the argument FOREGROUND.

The optional FACE argument determines the values of other face attributes.

Source Code

;; Defined in /usr/src/emacs/lisp/faces.el.gz
(defun faces--string-with-color (string color &optional foreground face)
  "Return a copy of STRING with face attributes for COLOR.
Set the :background or :foreground attribute to COLOR, depending
on the argument FOREGROUND.

The optional FACE argument determines the values of other face
attributes."
  (let* ((defaults (if face (list face) '()))
         (colors (cond (foreground
                        (list :foreground color))
                       (face
                        (list :background color))
                       (t
                        (list :foreground (readable-foreground-color color)
                              :background color)))))
    (propertize string 'face (cons colors defaults))))