Changing Highlight Line Color in Emacs

Changing highlight line color in emacs

That would be an easy fix if you customize your init file (~/.emacs, ~/.emacs.el, or ~/.emacs.d/init.el)

Turn on hl-line:

(global-hl-line-mode 1)

Set any color as the background face of the current line:

(set-face-background 'hl-line "#3e4446")

To keep syntax highlighting in the current line:

(set-face-foreground 'highlight nil)

How do I change the highlight color for selected text with Emacs / deftheme?

What you're looking for is the region face. For example:

(set-face-attribute 'region nil :background "#666")

Change Emacs syntax highlighting colors

I find it easiest to use color-theme for this sort of thing.

But if you don't want to do that, put the cursor over the offending text, and hit M-x customize-face. It should default to the face that the cursor is over.

See 49.1.6 Customizing Specific Items.

In emacs, how do I highlight and flash current line with a changing backcolor as the following video did?

That is Beacon mode. It eases finding the cursor (point) when changing windows or when scrolling.

Emacs hl-line: change color locally

hl-line-face is a variable containing the face to use for hl-line-mode, so we can make that variable buffer-local in these modes, and assign it a new custom face.

You can create a new face like this:

(defface gnus-hl-line
'((t :inherit hl-line))
"Face for highlighting the current line with `gnus-hl-line'."
:group 'hl-line)

and customize it with M-x customize-face RET gnus-hl-line RET

Then add this in your gnus-hl-line function (before calling hl-line-mode would seem most sensible).

(set (make-local-variable 'hl-line-face) 'gnus-hl-line)

emacs: how to change the foreground color of highlights (e.g., links the point is over)?

What you have discovered is that it cannot be done. For one thing, the mouse-face text property is independent of the face property. For another, face attributes are defined statically; they cannot be inherited dynamically.

Consider filing an Emacs enhancement request for such a capability (it is not limited to highlight or to mouse-face etc.), using M-x report-emacs-bug. (Yes, that command is for enhancement requests also.)



Related Topics



Leave a reply



Submit