Next: , Previous: Line Height, Up: Display

38.12 Faces

A face is a collection of graphical attributes for displaying text: font, foreground color, background color, optional underlining, etc. Faces control how Emacs displays text in buffers, as well as other parts of the frame such as the mode line.

One way to represent a face is as a property list of attributes, like (:foreground "red" :weight bold). For example, you can assign such an anonymous face as the value of the face text property; this causes Emacs to display the underlying text with the specified attributes. See Special Properties.

More commonly, a face is referred to via a face name: a Lisp symbol which is associated with a set of face attributes. Named faces are defined using the defface macro (see Defining Faces). Emacs defines several standard named faces; See Standard Faces.

Many parts of Emacs require named faces, and do not accept anonymous faces. These include the functions documented in Attribute Functions, and the variable font-lock-keywords (see Search-based Fontification). Unless otherwise stated, we will use the term face to refer only to named faces.

For backward compatibility, you can also use a string to specify a face name; that is equivalent to a Lisp symbol with the same name.

— Function: facep object

This function returns a non-nil value if object is a named face: a Lisp symbol or string which serves as a face name. Otherwise, it returns nil.

By default, each face name corresponds to the same set of attributes in all frames. But you can also assign a face name a special set of attributes in one frame (see Attribute Functions).