help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Display line number on each buffer line


From: Michael Heerdegen
Subject: Re: Display line number on each buffer line
Date: Sat, 04 Dec 2021 00:47:29 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

fatiparty--- via Users list for the GNU Emacs text editor
<help-gnu-emacs@gnu.org> writes:

> I think emacs can distinguish between light and dark background.  How
> does one adapt the colours so they are different on light and dark
> frame backgrounds, for reasons of legibility?

I do it like this:

(face-spec-set 'line-number
               '((((class color) (background dark))
                  :foreground "red" :height .6)
                 (((class color) (background light))
                  :foreground "tan" :height .6))
               'face-defface-spec)

The syntax of face specs is documented in the manual.

For finding good colors you can either try colors interactively with the
customize interface without saving and then copy the color names.  Also
inheriting from other faces is possible, like this:

(face-spec-set 'line-number
               '((t :inherit font-lock-comment-face))
               'face-defface-spec)

This is more appropriate when defining new faces, though.

If you don't want to rely on the custom save file, and you also don't
want to clobber your init file with face settings, an alternative is to
define your own custom theme - see

  (info "(elisp) Custom Themes")

Michael.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]