-
Notifications
You must be signed in to change notification settings - Fork 2
/
readable-typo-theme.el
270 lines (220 loc) · 10.5 KB
/
readable-typo-theme.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
;;; readable-typo-theme.el --- Readable typographic theme -*- coding: utf-8; lexical-binding: t -*-
;; Copyright (C) 2022 Terje Larsen
;; All rights reserved.
;; Author: Terje Larsen <[email protected]>
;; URL: https://github.com/terlar/emacs-config
;; Keywords: faces
;; Version: 0.1
;; Package-Requires: ((emacs "24.3"))
;; This file is NOT part of GNU Emacs.
;; readable-typo-theme is free software: you can redistribute it and/or modify it under
;; the terms of the GNU General Public License as published by the Free Software
;; Foundation, either version 3 of the License, or (at your option) any later version.
;; readable-typo-theme is distributed in the hope that it will be useful, but WITHOUT ANY
;; WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
;; PARTICULAR PURPOSE. See the GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;; Typographic theme to achieve a more readable and pleasant experience.
;;; Code:
(deftheme readable-typo "Readable typographic theme.")
(defgroup readable-typo-theme nil
"Readable typographic theme customization options."
:group 'faces)
;;;; Customization options
(defcustom readable-typo-theme-default-font-height 120
"Default font height."
:type 'string
:group 'readable-typo-theme)
(defcustom readable-typo-theme-font-scaling t
"Scale font sizes."
:type 'boolean
:group 'readable-typo-theme)
(defcustom readable-typo-theme-font-height-small 0.8
"Small font height."
:type 'string
:group 'readable-typo-theme)
(defcustom readable-typo-theme-font-height-title 1.8
"Title font height."
:type 'string
:group 'readable-typo-theme)
(defcustom readable-typo-theme-font-height-level-1 1.6
"Level 1 font height."
:type 'string
:group 'readable-typo-theme)
(defcustom readable-typo-theme-font-height-level-2 1.4
"Level 2 font height."
:type 'string
:group 'readable-typo-theme)
(defcustom readable-typo-theme-font-height-level-3 1.2
"Level 3 font height."
:type 'string
:group 'readable-typo-theme)
(defcustom readable-typo-theme-font-height-level-4 1.1
"Level 4 font height."
:type 'string
:group 'readable-typo-theme)
(defcustom readable-typo-theme-font-height-level-5 1.1
"Level 5 font height."
:type 'string
:group 'readable-typo-theme)
(defcustom readable-typo-theme-font-height-level-6 1.1
"Level 6 font height."
:type 'string
:group 'readable-typo-theme)
(defcustom readable-typo-theme-font-height-level-7 1.1
"Level 7 font height."
:type 'string
:group 'readable-typo-theme)
(defcustom readable-typo-theme-font-height-level-8 1.1
"Level 8 font height."
:type 'string
:group 'readable-typo-theme)
(defcustom readable-typo-theme-default-font-weight 'light
"Default font weight."
:type 'string
:group 'readable-typo-theme)
(defcustom readable-typo-theme-bold-font-weight 'medium
"Bold font weight."
:type 'string
:group 'readable-typo-theme)
(defcustom readable-typo-theme-line-spacing 0.25
"Spacing between lines."
:type 'number
:group 'readable-typo-theme)
(defcustom readable-typo-theme-fixed-pitch-font "Monospace"
"Font used for fixed-pitch."
:type 'string
:group 'readable-typo-theme)
(defcustom readable-typo-theme-fixed-pitch-serif-font "Monospace"
"Font used for fixed-pitch serif."
:type 'string
:group 'readable-typo-theme)
(defcustom readable-typo-theme-variable-pitch-font "sans-serif"
"Font used for variable-pitch."
:type 'string
:group 'readable-typo-theme)
(defcustom readable-typo-theme-serif-font "serif"
"Font used for serif."
:type 'string
:group 'readable-typo-theme)
;;;; Faces
(defface readable-typo-theme-echo-area
nil
"Face used for echo area."
:group 'readable-mono-theme)
(let ((default-height readable-typo-theme-default-font-height)
(default-weight readable-typo-theme-default-font-weight)
(bold-weight readable-typo-theme-bold-font-weight)
(fixed-pitch readable-typo-theme-fixed-pitch-font)
(fixed-pitch-serif readable-typo-theme-fixed-pitch-serif-font)
(variable-pitch readable-typo-theme-variable-pitch-font)
(serif readable-typo-theme-serif-font)
(small-height (if readable-typo-theme-font-scaling readable-typo-theme-font-height-small nil))
(title-height (if readable-typo-theme-font-scaling readable-typo-theme-font-height-title nil))
(level-1-height (if readable-typo-theme-font-scaling readable-typo-theme-font-height-level-1 nil))
(level-2-height (if readable-typo-theme-font-scaling readable-typo-theme-font-height-level-2 nil))
(level-3-height (if readable-typo-theme-font-scaling readable-typo-theme-font-height-level-3 nil))
(level-4-height (if readable-typo-theme-font-scaling readable-typo-theme-font-height-level-4 nil))
(level-5-height (if readable-typo-theme-font-scaling readable-typo-theme-font-height-level-5 nil))
(level-6-height (if readable-typo-theme-font-scaling readable-typo-theme-font-height-level-6 nil))
(level-7-height (if readable-typo-theme-font-scaling readable-typo-theme-font-height-level-7 nil))
(level-8-height (if readable-typo-theme-font-scaling readable-typo-theme-font-height-level-8 nil)))
;;;; Theme faces
(custom-theme-set-faces
'readable-typo
`(default ((t (:height ,default-height :family ,fixed-pitch :weight ,default-weight))))
`(bold ((t (:weight ,bold-weight))))
'(bold-italic ((t (:inherit bold))))
`(fixed-pitch ((t (:family ,fixed-pitch :weight ,default-weight))))
`(fixed-pitch-serif ((t (:family ,fixed-pitch-serif :weight ,default-weight))))
`(variable-pitch ((t (:family ,variable-pitch :weight ,default-weight))))
`(variable-pitch-text ((t (:height 1.1 :family ,serif))))
'(link ((t (:inherit underline))))
`(readable-typo-theme-echo-area ((t (:family ,variable-pitch :weight ,default-weight))))
;;;;; Interface
`(mode-line-active ((t (:family ,variable-pitch :height ,small-height))))
`(mode-line-inactive ((t (:family ,variable-pitch :height ,small-height))))
`(header-line ((t (:family ,variable-pitch :height ,small-height))))
`(line-number ((t (:family ,fixed-pitch))))
`(whitespace-space ((t (:family ,fixed-pitch))))
`(help-key-binding ((t (:inherit fixed-pitch))))
;;;;; font-lock
'(font-lock-comment-face ((t (:inherit italic))))
'(font-lock-type-face ((t (:inherit bold))))
'(font-lock-builtin-face ((t (:inherit bold))))
'(font-lock-keyword-face ((t (:inherit bold))))
;;;;; corfu
`(corfu-default ((t (:family ,fixed-pitch))))
;;;;; Info
`(info-title-1 ((t (:height ,level-1-height))))
`(info-title-2 ((t (:height ,level-2-height))))
`(info-title-3 ((t (:height ,level-3-height))))
`(info-title-4 ((t (:height ,level-4-height :slant italic))))
;;;;; magit
`(magit-section-heading ((t (:family ,variable-pitch :height ,level-2-height))))
;;;;; markdown
`(markdown-header-face-1 ((t (:height ,level-1-height :weight ,bold-weight))))
`(markdown-header-face-2 ((t (:height ,level-2-height :weight ,bold-weight))))
`(markdown-header-face-3 ((t (:height ,level-3-height :weight ,bold-weight))))
`(markdown-header-face-4 ((t (:height ,level-4-height :weight ,bold-weight :slant italic))))
`(markdown-header-face-5 ((t (:height ,level-5-height :weight ,bold-weight :slant italic))))
`(markdown-header-face-6 ((t (:height ,level-6-height :weight ,bold-weight :slant italic))))
`(markdown-code-face ((t (:family ,fixed-pitch))))
`(markdown-gfm-checkbox-face ((t (:family ,fixed-pitch))))
`(markdown-inline-code-face ((t (:family ,fixed-pitch))))
`(markdown-markup-face ((t (:family ,fixed-pitch))))
`(markdown-pre-face ((t (:family ,fixed-pitch))))
`(markdown-table-face ((t (:family ,fixed-pitch))))
;;;;; org
`(org-document-title ((t (:height ,title-height :weight ,bold-weight))))
`(org-level-1 ((t (:height ,level-1-height :weight ,bold-weight))))
`(org-level-2 ((t (:height ,level-2-height :weight ,bold-weight))))
`(org-level-3 ((t (:height ,level-3-height :weight ,bold-weight))))
`(org-level-4 ((t (:height ,level-4-height :weight ,bold-weight :slant italic))))
`(org-level-5 ((t (:height ,level-5-height :weight ,bold-weight :slant italic))))
`(org-level-6 ((t (:height ,level-6-height :weight ,bold-weight :slant italic))))
`(org-level-7 ((t (:height ,level-7-height :weight ,bold-weight :slant italic))))
`(org-level-8 ((t (:height ,level-8-height :weight ,bold-weight :slant italic))))
`(org-list-dt ((t (:weight ,bold-weight))))
`(org-block ((t (:family ,fixed-pitch))))
`(org-checkbox ((t (:family ,fixed-pitch))))
`(org-code ((t (:family ,fixed-pitch))))
`(org-meta-line ((t (:family ,fixed-pitch))))
`(org-table ((t (:family ,fixed-pitch))))
`(org-verbatim ((t (:family ,fixed-pitch))))
`(org-agenda-structure ((t (:family ,variable-pitch :height ,level-1-height))))
;;;;; outline
`(outline-1 ((t (:height ,level-1-height :weight ,bold-weight))))
`(outline-2 ((t (:height ,level-2-height :weight ,bold-weight))))
`(outline-3 ((t (:height ,level-3-height :weight ,bold-weight))))
`(outline-4 ((t (:height ,level-4-height :weight ,bold-weight :slant italic))))
`(outline-5 ((t (:height ,level-5-height :weight ,bold-weight :slant italic))))
`(outline-6 ((t (:height ,level-6-height :weight ,bold-weight :slant italic))))
`(outline-7 ((t (:height ,level-7-height :weight ,bold-weight :slant italic))))
`(outline-8 ((t (:height ,level-8-height :weight ,bold-weight :slant italic))))
`(outline-minor-0 ((t (:family ,serif))))
;;;;; rst
`(rst-level-1 ((t (:height ,level-1-height :weight ,bold-weight))))
`(rst-level-2 ((t (:height ,level-2-height :weight ,bold-weight))))
`(rst-level-3 ((t (:height ,level-3-height :weight ,bold-weight))))
`(rst-level-4 ((t (:height ,level-4-height :weight ,bold-weight :slant italic))))
`(rst-level-5 ((t (:height ,level-5-height :weight ,bold-weight :slant italic))))
`(rst-level-6 ((t (:height ,level-6-height :weight ,bold-weight :slant italic))))
`(rst-literal ((t (:family ,fixed-pitch))))
;;;;; spray
`(spray-base-face ((t (:inherit default :family ,serif :weight ,bold-weight)))))
;;;; Theme variables
(custom-theme-set-variables
'readable-typo
`(line-spacing ,readable-typo-theme-line-spacing)
`(x-underline-at-descent-line t)))
;;;###autoload
(and load-file-name
(boundp 'custom-theme-load-path)
(add-to-list 'custom-theme-load-path
(file-name-as-directory (file-name-directory load-file-name))))
(provide-theme 'readable-typo)
(provide 'readable-typo-theme)
;;; readable-typo-theme.el ends here