Skip to content

Commit 14f9d9d

Browse files
committed
Add colorful parentheses
1 parent d0ba563 commit 14f9d9d

File tree

3 files changed

+55
-3
lines changed

3 files changed

+55
-3
lines changed

.emacs

+13-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
;;; Emacs4CL 0.2.0 <https://github.com/susam/emacs4cl>
1+
;;; Emacs4CL 0.3.0 <https://github.com/susam/emacs4cl>
22

33
;; Customize user interface.
44
(menu-bar-mode 0)
@@ -56,3 +56,15 @@
5656
(add-hook 'lisp-mode-hook 'rainbow-delimiters-mode)
5757
(add-hook 'lisp-interaction-mode-hook 'rainbow-delimiters-mode)
5858
(add-hook 'slime-repl-mode-hook 'rainbow-delimiters-mode)
59+
60+
;; Customize colors for Rainbow Delimiters.
61+
(require 'rainbow-delimiters)
62+
(set-face-foreground 'rainbow-delimiters-depth-1-face "#f99") ; red
63+
(set-face-foreground 'rainbow-delimiters-depth-2-face "#9f9") ; green
64+
(set-face-foreground 'rainbow-delimiters-depth-3-face "#9cf") ; blue
65+
(set-face-foreground 'rainbow-delimiters-depth-4-face "#ff9") ; yellow
66+
(set-face-foreground 'rainbow-delimiters-depth-5-face "#9ff") ; cyan
67+
(set-face-foreground 'rainbow-delimiters-depth-6-face "#f9f") ; magenta
68+
(set-face-foreground 'rainbow-delimiters-depth-7-face "#fff") ; white
69+
(set-face-foreground 'rainbow-delimiters-depth-8-face "#ccc") ; light gray
70+
(set-face-foreground 'rainbow-delimiters-depth-9-face "#999") ; dark gray

CHANGES.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
0.2.0 (2020-02-21)
1+
0.3.0 (2021-10-29)
2+
------------------
3+
4+
### Added
5+
6+
- Customize Rainbow Delimiters colors to show colorful parentheses.
7+
8+
9+
0.2.0 (2021-02-21)
210
------------------
311

412
### Added

README.md

+33-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ like:
2525

2626
[![Screenshot of Emacs][screenshot]][screenshot]
2727

28-
[screenshot]: https://i.imgur.com/OUFvQdh.png
28+
[screenshot]: https://i.imgur.com/3BttNWM.png
2929

3030
If you are already comfortable with Emacs and only want to understand
3131
the content of the [`.emacs`] file, you can skip ahead directly to the
@@ -55,6 +55,7 @@ Contents
5555
* [Install Packages](#install-packages)
5656
* [Inferior Lisp Program](#inferior-lisp-program)
5757
* [Add Hooks](#add-hooks)
58+
* [Colorful Parentheses](#colorful-parentheses)
5859
* [Opinion References](#opinion-references)
5960
* [Channels](#channels)
6061
* [License](#license)
@@ -1109,6 +1110,36 @@ Dec 2020. See https://github.com/Fanael/rainbow-delimiters/issues/57 for
11091110
more details.
11101111
11111112
1113+
### Colorful Parentheses
1114+
1115+
The default colors that Rainbow Delimiters chooses for the nested
1116+
parentheses are too subtle to easily recognize the matching pair of
1117+
parentheses. Some Lisp programmers like to customize the colors to
1118+
make the parentheses look more colorful. This section shows one way to
1119+
do this.
1120+
1121+
- This is necessary to use the various Rainbow Delimiters faces that
1122+
appear in the next point.
1123+
1124+
```elisp
1125+
(require 'rainbow-delimiters)
1126+
```
1127+
1128+
- Set different colors for parentheses at different nesting level.
1129+
1130+
```elisp
1131+
(set-face-foreground 'rainbow-delimiters-depth-1-face "#f99") ; red
1132+
(set-face-foreground 'rainbow-delimiters-depth-2-face "#9f9") ; green
1133+
(set-face-foreground 'rainbow-delimiters-depth-3-face "#9cf") ; blue
1134+
(set-face-foreground 'rainbow-delimiters-depth-4-face "#ff9") ; yellow
1135+
(set-face-foreground 'rainbow-delimiters-depth-5-face "#9ff") ; cyan
1136+
(set-face-foreground 'rainbow-delimiters-depth-6-face "#f9f") ; magenta
1137+
(set-face-foreground 'rainbow-delimiters-depth-7-face "#fff") ; white
1138+
(set-face-foreground 'rainbow-delimiters-depth-8-face "#ccc") ; light gray
1139+
(set-face-foreground 'rainbow-delimiters-depth-9-face "#999") ; dark gray
1140+
```
1141+
1142+
11121143
Opinion References
11131144
------------------
11141145
@@ -1160,6 +1191,7 @@ Release Checklist
11601191
- Update version number in .emacs.
11611192
- Update year in LICENSE.md.
11621193
- Update CHANGES.md.
1194+
- Add new screenshot (120x32) if necessary.
11631195
- Commit changes.
11641196
11651197
git add -p

0 commit comments

Comments
 (0)