poet-theme.el (19425B)
1 ;;; poet-theme.el --- A theme for prose. 2 3 ;; Copyright 2018-now Kunal Bhalla 4 5 ;; Author: Kunal Bhalla <bhalla.kunal@gmail.com> 6 ;; URL: https://github.com/kunalb/poet/ 7 ;; Version: 2.0 8 9 ;;; Commentary: 10 11 ;; Emacs has very good support for multiple fonts in a single 12 ;; file. Poet uses this support to make it much more convenient to 13 ;; write prose within Emacs, with particular attention paid to 14 ;; org-mode and markdown-mode. Code blocks, tables, etc are 15 ;; formatted in monospace text with the appropriate backgrounds. 16 17 ;; Recommended customizations for using this theme 18 ;; 19 ;; - Set up the base fonts you'd like to use in Emacs before loading Poet 20 ;; (set-face-attribute 'default nil :family "Iosevka" :height 130) 21 ;; (set-face-attribute 'fixed-pitch nil :family "Iosevka") 22 ;; (set-face-attribute 'variable-pitch nil :family "Baskerville") 23 ;; On loading this theme captures the default and treats that for fixed-pitch 24 ;; rendering. 25 ;; 26 ;; - Enable variable pitch mode for editing text 27 ;; (add-hook 'text-mode-hook 28 ;; (lambda () 29 ;; (variable-pitch-mode 1)) 30 ;; 31 ;; - Some other modes I like to enable/disable 32 ;; (olivetti-mode 1) ;; Centers text in the buffer 33 ;; (flyspell-mode 1) ;; Catch Spelling mistakes 34 ;; (typo-mode 1) ;; Good for symbols like em-dash 35 ;; (blink-cursor-mode 0) ;; Reduce visual noise 36 ;; (linum-mode 0) ;; No line numbers for prose 37 ;; 38 ;; - And prettier org mode bullets: 39 ;; (setq org-bullets-bullet-list 40 ;; '("◉" "○")) 41 ;; (org-bullets 1) 42 43 ;;; Code: 44 45 (set-face-attribute 'default nil :family "Roboto Mono") 46 (set-face-attribute 'fixed-pitch nil :family "Roboto Mono") 47 48 (defvar poet--monospace-height 49 (face-attribute 'fixed-pitch :height nil 'default) 50 "The original height stored as a defvar to stay constant across reloads.") 51 52 (defun poet--height (multiplier) 53 "Scale up the height according to the MULTIPLIER." 54 (truncate (* poet--monospace-height multiplier))) 55 56 (deftheme poet 57 "A prose friendly theme.") 58 59 (make-face 'mode-line-height) 60 (set-face-attribute 'mode-line-height nil 61 :foreground "#8888cc" :background "#8888cc" 62 :inverse-video nil 63 :box '(:line-width 6 :color "#8888cc" :style nil)) 64 65 (let ( 66 ;; Primary Colors 67 (fg "#444444") 68 ;; (bg "#e1d9c2") 69 ;; (bg "#f6f6f6") 70 (bg "#FFFFea") 71 72 (modeline "#EAFFFF") 73 74 (white-light "#ffffff") 75 (yellow-light "#fff59d") 76 (red-light "#ff1744") 77 78 (black "gray0") 79 (white "gray88") 80 (yellow "#fff176") 81 (blue "#0288D1") 82 (green "#388E3C") 83 (red "#bf360c") 84 (purple "#673AB7") 85 (brown "#8D6E63") 86 87 ;; dark colors 88 (cyan-dark "#455A64") 89 (blue-dark "#3f51b5") 90 (red-dark "#8E3C38") 91 (purple-dark "#6C3082") 92 (brown-dark "#4e342e") 93 ) 94 (let ( 95 (emph "gray13") 96 ;; (sep "gray90") 97 (sep "gray50") 98 (hlt "gray93") 99 ;; (bg-hlt "#fff8e1") 100 (bg-hlt "#e4e4e4") 101 (meta brown-dark) 102 (link "#303f9f") 103 (link-underline "#304ffe") 104 (vlink-underline "#1a237e") 105 (button "gray27") 106 (cursor "gray29") 107 (paren-match-bg red-light) 108 (paren-match-fg white-light) 109 (search-fg red) 110 (search-bg white-light) 111 (search-fail-bg "#f8bbd0") 112 (tooltip-fg "#111111") 113 (tooltip-bg yellow) 114 (shadow "grey60") 115 (secondary-bg yellow-light) 116 (trailing-bg "#ff8a65") 117 (fci "grey87") 118 (mode-line-fg "grey7") 119 (mode-line-hlt white-light) 120 (mode-line-inactive "#888888") 121 (header red-dark) 122 (header-line-bg white) 123 (builtin red-dark) 124 (string green) 125 (function-name "#444444") 126 (keyword "#444444") 127 (constant blue) 128 (type "#444444") 129 (variable cyan-dark) 130 131 ;; org 132 (org-meta brown) 133 (org-document-info brown) 134 (org-table white) 135 (org-quote-fg purple-dark) 136 (org-quote-bg white) 137 (org-date "#444444") 138 (org-title red) 139 (org-title-underline "#aaaaaa") 140 (org-checkbox "#aaaaaa") 141 (org-scheduled "#333333") 142 (org-scheduled-today "#111111") 143 (org-done green) 144 (org-todo red) 145 (org-tag "#777777") 146 (org-block-line "#d0d0d0") 147 (org-block-bg white) 148 (org-agenda-structure-fg "#555555") 149 (org-agenda-structure-bg white) 150 (org-agenda-today-fg "#000000") 151 (org-agenda-today-bg "#eeeeee") 152 (org-special-keyword "#777777") 153 (org-sched-prev "#222222") 154 (org-agenda-done "#777777") 155 156 (hl-line "#efefef") 157 (linum-hlt "#555555") 158 (linum "#aaaaaa") 159 (markdown-markup brown) 160 (markdown-metadata "#777777") 161 (markdown-language purple) 162 (markdown-list "#000000") 163 (markdown-code-bg white) 164 (markdown-pre-bg white) 165 (markdown-header-delimiter brown) 166 (imenu brown-dark)) 167 (custom-theme-set-faces 'poet 168 `(variable-pitch ((t (:family ,(face-attribute 'variable-pitch :family) :height ,(poet--height 1))))) 169 170 `(default ((t (:background ,bg :foreground ,fg)))) 171 `(italic ((t (:foreground ,emph :slant italic)))) 172 `(highlight ((t (:background ,hlt :overline nil)))) 173 `(region ((t (:background ,bg-hlt)))) 174 `(fringe ((t (:background ,bg)))) 175 `(button ((t (:inherit default :foreground ,button)))) 176 `(escape-glyph ((t (:foreground ,purple)))) 177 `(link ((t (:underline (:color ,link-underline :style line) :foreground ,link)))) 178 `(link-visited ((t (:inherit link :foreground ,link :underline (:color ,vlink-underline :style line))))) 179 `(cursor ((t (:background ,cursor)))) 180 `(show-paren-match ((t (:background ,paren-match-fg :foreground ,paren-match-bg)))) 181 `(isearch ((t (:foreground ,search-fg :background ,search-bg)))) 182 `(isearch-fail ((t (:background ,search-fail-bg)))) 183 `(query-replace ((t (:inherit isearch)))) 184 `(tooltip ((t (:inherit default :foreground ,tooltip-fg :background ,tooltip-bg)))) 185 `(shadow ((t (:foreground ,shadow)))) 186 `(secondary-selection ((t (:background ,secondary-bg)))) 187 `(trailing-whitespace ((t (:background ,trailing-bg)))) 188 `(lazy-highlight ((t (:foreground ,black :background ,white-light)))) 189 `(next-error ((t (:inherit region)))) 190 `(window-divider ((t (:background ,sep :foreground ,sep)))) 191 `(vertical-border ((t (:background ,sep :foreground ,sep)))) 192 `(minibuffer-prompt ((t (:inherit fixed-pitch :weight bold :foreground ,meta)))) 193 194 ;; mode line 195 `(header-line ((t (:overline nil :background ,header-line-bg :box (:line-width 1 :color "#8888cc") :underline ,sep :inherit mode-line)))) 196 197 `(mode-line ((t (:inherit fixed-pitch :foreground ,mode-line-fg :background ,modeline :overline ,sep :box (:line-width 1 :color "#8888cc"))))) 198 `(mode-line-inactive ((t (:inherit fixed-pitch :foreground ,mode-line-inactive :background ,modeline :overline ,sep :box (:line-width 1 :color "#8888cc"))))) 199 200 `(mode-line-buffer-id ((t (:weight bold)))) 201 `(mode-line-emphasis ((t (:weight bold)))) 202 `(mode-line-highlight ((t (:background ,mode-line-hlt)))) 203 204 `(error ((t (:inherit fixed-pitch)))) 205 206 ;; primary font lock 207 `(font-lock-comment-face ((t (:foreground ,shadow :inherit fixed-pitch)))) 208 `(font-lock-builtin-face ((t (:foreground ,builtin :inherit fixed-pitch)))) 209 `(font-lock-string-face ((t (:inherit fixed-pitch :foreground ,string)))) 210 `(font-lock-function-name-face ((t (:inherit fixed-pitch :foreground ,function-name)))) 211 `(font-lock-keyword-face ((t (:inherit fixed-pitch :weight bold :foreground ,keyword)))) 212 `(font-lock-comment-delimiter-face ((t (:inherit fixed-pitch :inherit font-lock-comment-face)))) 213 `(font-lock-constant-face ((t (:inherit fixed-pitch)))) 214 `(font-lock-doc-face ((t (:inherit fixed-pitch :inherit font-lock-string-face)))) 215 `(font-lock-preprocessor-face ((t (:inherit fixed-pitch :inherit font-lock-builtin-face)))) 216 `(font-lock-regexp-grouping-backslash ((t (:inherit fixed-pitch :inherit bold)))) 217 `(font-lock-regexp-grouping-construct ((t (:inherit fixed-pitch :inherit bold)))) 218 `(font-lock-type-face ((t (:inherit fixed-pitch)))) 219 `(font-lock-variable-name-face ((t (:inherit fixed-pitch :foreground ,variable)))) 220 `(font-lock-warning-face ((t (:inherit error)))) 221 222 ;; Org 223 `(org-level-1 ((t (:inherit default :foreground ,header :height ,(poet--height 1.5))))) 224 `(org-level-2 ((t (:inherit default :foreground ,header :height ,(poet--height 1.4))))) 225 `(org-level-3 ((t (:inherit default :foreground ,header :height ,(poet--height 1.3))))) 226 `(org-level-4 ((t (:inherit default :foreground ,header :height ,(poet--height 1.23))))) 227 `(org-level-5 ((t (:inherit default :foreground ,header :height ,(poet--height 1.23))))) 228 `(org-level-6 ((t (:inherit default :foreground ,header :height ,(poet--height 1.23))))) 229 `(org-level-7 ((t (:inherit default :foreground ,header :height ,(poet--height 1.23))))) 230 `(org-level-8 ((t (:inherit default :foreground ,header :height ,(poet--height 1.23))))) 231 `(org-meta-line ((t (:inherit fixed-pitch :foreground ,org-meta)))) 232 `(org-document-info-keyword ((t (:inherit fixed-pitch :foreground ,org-document-info)))) 233 `(org-document-info ((t (:inherit default :foreground ,org-document-info)))) 234 `(org-verbatim ((t (:inherit fixed-pitch)))) 235 `(org-table ((t (:inherit fixed-pitch :background ,org-table)))) 236 `(org-formula ((t (:inherit org-table :height ,(poet--height 1))))) 237 `(org-quote ((t (:inherit default :foreground ,org-quote-fg :background ,org-quote-bg)))) 238 `(org-hide ((t (:inherit fixed-pitch :foreground ,bg)))) 239 `(org-indent ((t (:inherit org-hide)))) 240 `(org-date ((t (:inherit fixed-pitch :foreground ,org-date :underline nil)))) 241 `(org-document-title ((t (:inherit default :foreground ,org-title :height ,(poet--height 1.8) :underline (:color ,org-title-underline))))) 242 `(org-checkbox ((t (:inherit fixed-pitch :weight bold :foreground ,org-checkbox)))) 243 `(org-scheduled ((t (:foreground ,org-scheduled)))) 244 `(org-scheduled-today ((t (:foreground ,org-scheduled-today)))) 245 `(org-done ((t (:inherit fixed-pitch :foreground ,org-done)))) 246 `(org-todo ((t (:inherit fixed-pitch :foreground ,org-todo)))) 247 `(org-tag ((t (:inherit fixed-pitch :height ,(poet--height 1) :foreground ,org-tag)))) 248 `(org-block-begin-line ((t (:inherit fixed-pitch :background ,org-block-line)))) 249 `(org-block-end-line ((t (:inherit fixed-pitch :background ,org-block-line)))) 250 `(org-block ((t (:background ,org-block-bg :inherit fixed-pitch)))) 251 `(org-priority ((t (:inherit fixed-pitch :weight normal)))) 252 `(org-agenda-structure ((t (:foreground ,org-agenda-structure-fg :background ,org-agenda-structure-bg :overline ,org-agenda-structure-bg :underline ,org-agenda-structure-bg)))) 253 `(org-agenda-date-weekend ((t (:inherit org-agenda-structure)))) 254 `(org-agenda-date-today ((t (:foreground ,org-agenda-today-fg :overline ,org-agenda-today-bg :background ,org-agenda-today-bg :underline ,org-agenda-today-bg)))) 255 `(org-special-keyword ((t (:inherit fixed-pitch :foreground ,org-special-keyword)))) 256 `(org-scheduled-previously ((t (:foreground ,org-sched-prev)))) 257 `(org-agenda-done ((t (:foreground ,org-agenda-done)))) 258 `(org-footnote ((t (:foreground ,link)))) 259 `(hl-line ((t (:background ,hl-line)))) 260 261 ;; line numbers 262 `(line-number ((t (:inherit fixed-pitch :foreground ,linum)))) 263 `(line-number-current-line ((t (:inherit fixed-pitch :foreground ,linum-hlt)))) 264 265 ;; markdown 266 `(markdown-header-face-1 ((t (:foreground ,header :inherit default :height ,(poet--height 1.5))))) 267 `(markdown-header-face-2 ((t (:foreground ,header :inherit default :height ,(poet--height 1.4))))) 268 `(markdown-header-face-3 ((t (:foreground ,header :inherit default :height ,(poet--height 1.3))))) 269 `(markdown-header-face-4 ((t (:foreground ,header :inherit default :height ,(poet--height 1.23))))) 270 `(markdown-header-face-5 ((t (:foreground ,header :inherit default :height ,(poet--height 1.23))))) 271 `(markdown-header-face-6 ((t (:foreground ,header :inherit default :height ,(poet--height 1.23))))) 272 `(markdown-header-face-7 ((t (:foreground ,header :inherit default :height ,(poet--height 1.23))))) 273 `(markdown-header-face-8 ((t (:foreground ,header :inherit default :height ,(poet--height 1.23))))) 274 `(markdown-markup-face ((t (:inherit fixed-pitch :foreground ,markdown-markup)))) 275 `(markdown-inline-code-face ((t (:inherit fixed-pitch)))) 276 `(markdown-metadata-key-face ((t (:inherit fixed-pitch :height ,(poet--height 1) :foreground ,markdown-metadata)))) 277 `(markdown-metadata-value-face ((t (:inherit fixed-pitch :height ,(poet--height 1) :foreground ,fg)))) 278 `(markdown-language-keyword-face ((t (:foreground ,markdown-language)))) 279 `(markdown-list-face ((t (:inherit fixed-pitch :foreground ,markdown-list)))) 280 `(markdown-code-face ((t (:inherit fixed-pitch :foreground ,fg :background ,markdown-code-bg)))) 281 `(markdown-pre-face ((t (:inherit fixed-pitch :color ,fg :background ,markdown-pre-bg)))) 282 `(markdown-header-delimiter-face ((t (:inherit fixed-pitch :foreground ,markdown-header-delimiter)))) 283 `(markdown-header-rule-face ((t (:inherit fixed-pitch :foreground ,markdown-header-delimiter)))) 284 `(markdown-url-face ((t (:inherit fixed-pitch :foreground ,link)))) 285 286 ;; ivy 287 `(ivy-current-match ((t (:inherit fixed-pitch :background ,hlt)))) 288 `(ivy-minibuffer-match-face-1 ((t (:inherit fixed-pitch :foreground ,cyan-dark)))) 289 `(ivy-minibuffer-match-face-2 ((t (:inherit fixed-pitch :foreground ,red-dark)))) 290 `(ivy-minibuffer-match-face-3 ((t (:inherit fixed-pitch :foreground ,blue-dark)))) 291 `(ivy-minibuffer-match-face-4 ((t (:inherit fixed-pitch :foreground ,brown-dark)))) 292 293 ;; imenu 294 `(imenu-list-entry-face-0 ((t (:foreground ,imenu)))) 295 `(imenu-list-entry-face-1 ((t (:foreground ,imenu)))) 296 `(imenu-list-entry-face-2 ((t (:foreground ,imenu)))) 297 `(imenu-list-entry-face-3 ((t (:foreground ,imenu)))) 298 `(imenu-list-entry-face-4 ((t (:foreground ,imenu)))) 299 `(imenu-list-entry-face-5 ((t (:foreground ,imenu)))) 300 301 ;; tldr 302 `(tldr-title ((t (:foreground ,red :weight bold :height 1.9)))) 303 `(tldr-description ((t (:foreground ,green)))) 304 `(tldr-code-block ((t ()))) 305 `(tldr-command-argument ((t ()))) 306 307 `(company-tooltip-selection ((t (:background "#ddffdd")))) 308 `(company-tooltip-selection ((t (:background "#cee7cf")))) 309 `(company-tooltip-common ((t (:inherit fixed-pitch :foreground nil :underline nil :weight bold)))) 310 `(company-scrollbar-fg ((t (:background "#388E3C")))) 311 `(company-preview-common ((t (:underline nil)))) 312 `(company-tooltip-common ((t (:underline nil)))) 313 `(company-tooltip-common-selection ((t (:underline nil)))) 314 315 ;; evil 316 `(evil-ex-substitute-replacement ((t (:foreground ,white-light :background ,brown-dark :underline nil)))) 317 `(evil-goggles-delete-face ((t (:inherit 'lazy-highlight)))) 318 `(evil-goggles-paste-face ((t (:inherit 'lazy-highlight)))) 319 `(evil-goggles-yank-face ((t (:inherit 'lazy-highlight)))) 320 321 `(helm-source-header ((t (:height ,(poet--height 1)))))) 322 323 (custom-theme-set-variables 'poet 324 '(line-spacing 0.4) 325 `(fci-rule-color ,fci)))) 326 327 ;;;###autoload 328 (when (and (boundp 'custom-theme-load-path) 329 load-file-name) 330 (add-to-list 'custom-theme-load-path 331 (file-name-as-directory 332 (file-name-directory load-file-name)))) 333 334 (provide-theme 'poet) 335 ;;; poet-theme.el ends here