I'm using Emacs 24; I've installed the zenburn theme, which is great, except I cannot see the selection highlight easily with the highlight color provided by zenburn:
https://i.stack.imgur.com/pZwnZ.png
By "selection" color, I mean the color of text that I've selected by setting a mark (C-space
and moving the cursor to select text).
For the life of me, I cannot figure out how to change it. I've tried changing every combination of highlight
, selection
, etc.. that I can think of in zenburn-theme.el
, but nothing seems to change it.
**For sanity's sake, I've tried changing other colors in the theme to make sure Emacs is loading the file properly - it is - those changes work.*
I would have especially thought that changing highlight
would work, but no customizations to the highlight
line seem to work:
;;;; Built-in
;;;;; basic coloring
...
`(highlight ((t (:background ,zenburn-bg-05 :foreground ,zenburn-yellow))))
How can I change the selection color?
What you're looking for is the region
face. For example:
(set-face-attribute 'region nil :background "#666")
In addition to tungd's solution. You could also then change the font color to make it more readable. E.g. to white
(set-face-attribute 'region nil :background "#666" :foreground "#ffffff")
foreground
.
You can use the customize interface.
M-x customize-face
When prompted for which face, enter region
. Then you'll see something like:
https://i.stack.imgur.com/L1uM0.png
Using customize makes it easy to experiment with lots of colors. Try clicking [ Choose ]
to access the color-picker), then [ Apply and Save ]
. It also nicely organizes your customizations into a single file (rather than further polluting your init.el
).
Success story sharing
isearch
, is there any way to change background color on the searched texts as well?isearch
uses a different face, a quick look atisearch.el
reveal that it is quite complicated sinceisearch
seems to be usinghighlight-regex
for highlighting. You'll probably need to dig in a bit further to find the face name that you want.