Flinkman
Flinkman

Reputation: 17745

How do I change the color-theme of [] and () in Emacs?

I want to have a very distinct color on [] and () but not the same.

Upvotes: 3

Views: 247

Answers (2)

Cheeso
Cheeso

Reputation: 192657

To figure out what face is in use by the [ ] and ( ) characters, or any character, put your cursor on the desired char, and then do M-x describe-char. This will tell you all about the char including the text properties on that char. One of the text properties will be the font face.

You can then do something like

(set-face-foreground 'facename "Orange")
(set-face-background 'facename "Purple")

or, for more control over the face, use these other functions:

set-face-background     
set-face-font   
set-face-inverse-video-p    
set-face-underline  
set-face-background-pixmap
set-face-foreground
set-face-stipple
set-face-underline-p

You can use these within emacs.el, globally, or you can call them in the mode hook function for your mode, to set the face just for a particular mode.

Upvotes: 2

snakehiss
snakehiss

Reputation: 8774

This depends on what faces are used which in turn is determined by what major and minor modes are being used in your buffer. If there are 2 different faces which correspond to [] and () then all you have to do is customize those faces. If there aren't 2 faces, then you will have to define one or both variations you want. The relevant function is called defface.

Upvotes: 1

Related Questions