When using parentheses matching, how can I set the color of the parenthesis my cursor is actually on?

I found I can use the below set-face-attribute to control the color of the other parenthesis, but I cannot find any info on how to control the color of the parenthesis I am on.

(set-face-attribute 'show-paren-match nil
                    :background "#ffffff"
                    :foreground "#000000")
  • 1
    Are you looking for rainbow-delimiters by any chance? The package is available in MELPA as well.
    – NickD
    Commented Mar 14, 2023 at 20:38
  • In addition to rainbow-delimiters you may find smartparens of interest.
    – slackline
    Commented Mar 15, 2023 at 22:56
  • @NickD: I guess OP only wants to change show-paren-mode’s color...
    – shynur
    Commented Mar 16, 2023 at 1:40
  • Search this site for [parentheses] [highlight].
    – Drew
    Commented Mar 22, 2023 at 3:41

2 Answers 2


C-h f show-paren-mode:

show-paren-mode is an interactive native-compiled Lisp function in ‘paren.el’.

Click ‘paren.el’ in your Emacs.

Find the definition of the function show-paren-function, and see:

(overlay-put show-paren--overlay-1 'face face))
;; ...
;; ...
(overlay-put show-paren--overlay 'face face))))))

You can replace the face (not 'face) with '(:background "yellow" :foreground "red"), then reevaluate this defun form.

The above steps will change how show-paren-mode displays color.

You may want to add some code to your .emacs to automate the above process.

  • 1
    Sincerely, rainbow-delimiters or highlight-parentheses may be a better choice.
    – shynur
    Commented Mar 16, 2023 at 1:44

Emacs comes with the convenient possibility to adjust all of the own settings using the therefore provided buffer interfaces.

To access properties of font faces choose in Emacs menu:

              Customize Emacs:
                               Specific Face ...

The buffer opened by this menu item comes with a [Search] function helping to find the appropriate face settings.

The keywords to use to get the settings related to highlighting parentheses are: 'paren' and 'face' (I must admit not that easy to guess ...):

dialog buffer

The color of the matching parenthesis can be set from there by opening the Show Paren Match dialog (click the left triangle) and the color of the parenthesis you are at (assuming that there is no match) by opening the Show Paren Mismatch:

enter image description here

With the settings above you will get:

closing paren orphan paren

To my knowledge it is not possible to set the color of the parenthesis you are at to a different color as the color of the matching parenthesis. And even if it would be possible, it would not make much sense anyway.

  • After I choose Options> Customize Emacs> Specific Face the mini-buffer at the bottom of the frame says, Customize face (default all faces): If I hit return to accept the default, then the Search bar shown in the screenshot opens in a buffer. I chose white for the color, and now I can see the parens through the white. Before I had steel-gray, and it wasn't transparent. To change the cursor color, see here: stackoverflow.com/a/24234743
    – 7stud
    Commented Mar 17 at 21:50
  • To bring up the Search bar, you can also do M-x customize-face <Ret> <Ret>.
    – 7stud
    Commented Mar 18 at 19:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.