rice

personal dot files and scripts for linux and macOS
Log | Files | Refs | README | LICENSE

acme-dark-theme.el (17497B)


      1 ;;; acme-dark-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/acme-dark/
      7 ;; Version: 2.0
      8 
      9 ;;; Commentary:
     10 
     11 ;; Emacs has very good support for multiple fonts in a single
     12 ;; file.  Acme-Dark 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 Acme-Dark
     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 (defvar acme-dark--monospace-height
     46  (face-attribute 'fixed-pitch :height nil 'default)
     47  "The original height stored as a defvar to stay constant across reloads.")
     48 
     49 (defvar mode-line-spacing 5)
     50 
     51 (defun acme-dark--height (multiplier)
     52  "Scale up the height according to the MULTIPLIER."
     53  (truncate (* acme-dark--monospace-height multiplier)))
     54 
     55 (deftheme acme-dark
     56   "A prose friendly theme.")
     57 
     58 (make-face 'mode-line-height)
     59 
     60 (let (
     61       ;; Primary Colors
     62       (fg       "#ebdbb2")
     63       (fg-light "#f5f5f5")
     64       (fg-dark  "#c5c5c5")
     65       (bg       "#1a1a17")
     66       (bg-light "#1f1f1a")
     67       (bg-dark  "#0a0a07")
     68 
     69       ; light colors
     70       (black-light  "#333333")
     71       (white-light  "#ffffff")
     72       (yellow-light "#fff59d")
     73       (red-light    "#ff1744")
     74 
     75       ; normal colors
     76       (black  "#111111")
     77       (white  "#dddddd")
     78       (yellow "#fff176")
     79       (blue   "#02a4fb")
     80       (green  "#388d3c")
     81       (cyan   "#80a6b9")
     82       (red    "#e9420f")
     83       (purple "#673ab7")
     84       (brown  "#b78f81")
     85 
     86       ;; dark colors
     87       (black-dark  "#000000")
     88       (white-dark  "#999999")
     89       (cyan-dark   "#455a64")
     90       (blue-dark   "#3f51b5")
     91       (red-dark    "#e3605a")
     92       (purple-dark "#4f4f77")
     93       (brown-dark  "#785047"))
     94 
     95   (let ((emph                white)
     96         (sep                 "gray8")
     97         (hlt                 "gray7")
     98         (bg-hlt              "#333333")
     99         (meta                brown-dark)
    100         (link                "#303F9F")
    101         (link-underline      "#304FFE")
    102         (vlink-underline     "#1A237E")
    103         (button              "gray73")
    104         (cursor              "gray71")
    105         (paren-match-bg      red-light)
    106         (paren-match-fg      bg)
    107         (search-fg           red-light)
    108         (search-bg           "#333333")
    109         (search-fail-bg      bg)
    110         (tooltip-fg          "#333333")
    111         (tooltip-bg          "#666666")
    112         (shadow              "#646464")
    113         (secondary-bg        "#333333")
    114         (trailing-bg         "#ff8a65")
    115         (mode-line-fg        white)
    116         (mode-line-hlt       white)
    117         (mode-line-inactive  white-dark)
    118         (header              red-dark)
    119         (header-line-bg      white)
    120         (string              green)
    121         (function-name       fg)
    122         (keyword             fg)
    123         (constant            blue)
    124         (type                fg)
    125         (variable            fg-dark)
    126         (modeline            bg-light)
    127         (modeline-border     bg-dark)
    128 
    129         ;; org
    130         (org-meta                brown)
    131         (org-document-info       brown)
    132         (org-table               white)
    133         (org-quote-fg            purple-dark)
    134         (org-quote-bg            white)
    135         (org-date                fg)
    136         (org-title               red)
    137         (org-title-underline     "#aaaaaa")
    138         (org-checkbox            "#aaaaaa")
    139         (org-scheduled           "#333333")
    140         (org-scheduled-today     "#111111")
    141         (org-done                green)
    142         (org-todo                red)
    143         (org-tag                 "#777777")
    144         (org-block-line          "#d0d0d0")
    145         (org-block-bg            white)
    146         (org-agenda-structure-fg "#555555")
    147         (org-agenda-structure-bg white)
    148         (org-agenda-today-fg     "#000000")
    149         (org-agenda-today-bg     fg)
    150         (org-special-keyword     "#777777")
    151         (org-sched-prev          "#222222")
    152         (org-agenda-done         "#777777")
    153 
    154         (hl-line                    "#efefef")
    155         (linum-hlt                  "#808080")
    156         (linum                      "#555555")
    157         (markdown-markup            brown)
    158         (markdown-metadata          "#777777")
    159         (markdown-language          purple)
    160         (markdown-list              "#000000")
    161         (markdown-code-bg           white)
    162         (markdown-pre-bg            white)
    163         (markdown-header-delimiter  brown)
    164         (imenu                      brown-dark))
    165 
    166 (set-face-attribute 
    167  (custom-theme-set-faces
    168   'acme-dark
    169   `(variable-pitch       ((t (:family ,(face-attribute 'variable-pitch :family) :height ,(acme-dark--height 1.25)))))
    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   `(mode-line            ((t (:inherit fixed-pitch :foreground ,mode-line-fg       :background ,modeline :overline ,modeline-border :box (:line-width 1 :color ,modeline-border)))))
    197   `(mode-line-inactive   ((t (:inherit fixed-pitch :foreground ,mode-line-inactive :background ,modeline :overline ,modeline-border :box (:line-width 1 :color ,modeline-border)))))
    198   `(mode-line-height     ((t (:foreground ,modeline-border :background ,modeline-border :box (:line-width ,mode-line-spacing :color ,modeline-border)))))
    199   `(mode-line-buffer-id  ((t (:weight bold))))
    200   `(mode-line-emphasis   ((t (:weight bold))))
    201   `(mode-line-highlight  ((t (:background ,mode-line-hlt))))
    202 
    203   `(error ((t (:inherit fixed-pitch))))
    204 
    205   ;; primary font lock
    206   `(font-lock-builtin-face               ((t (:inherit fixed-pitch :foreground ,red))))
    207   `(font-lock-comment-delimiter-face     ((t (:inherit fixed-pitch :inherit font-lock-comment-face))))
    208   `(font-lock-comment-face               ((t (:inherit fixed-pitch :foreground ,shadow))))
    209   `(font-lock-constant-face              ((t (:inherit fixed-pitch))))
    210   `(font-lock-doc-face                   ((t (:inherit fixed-pitch :inherit font-lock-string-face))))
    211   `(font-lock-function-name-face         ((t (:inherit fixed-pitch :foreground ,function-name))))
    212   `(font-lock-keyword-face               ((t (:inherit fixed-pitch :foreground ,keyword :weight bold ))))
    213   `(font-lock-preprocessor-face          ((t (:inherit fixed-pitch :inherit font-lock-builtin-face))))
    214   `(font-lock-regexp-grouping-backslash  ((t (:inherit fixed-pitch :inherit bold))))
    215   `(font-lock-regexp-grouping-construct  ((t (:inherit fixed-pitch :inherit bold))))
    216   `(font-lock-string-face                ((t (:inherit fixed-pitch :foreground ,string))))
    217   `(font-lock-type-face                  ((t (:inherit fixed-pitch))))
    218   `(font-lock-variable-name-face         ((t (:inherit fixed-pitch :foreground ,variable))))
    219   `(font-lock-warning-face               ((t (:inherit error))))
    220 
    221   ;; Org
    222   `(org-level-1                ((t (:inherit default :foreground ,header :height ,(acme-dark--height 1.3)))))
    223   `(org-level-2                ((t (:inherit default :foreground ,header :height ,(acme-dark--height 1.2)))))
    224   `(org-level-3                ((t (:inherit default :foreground ,header :height ,(acme-dark--height 1.1)))))
    225   `(org-level-4                ((t (:inherit default :foreground ,header :height ,(acme-dark--height 1)))))
    226   `(org-level-5                ((t (:inherit default :foreground ,header :height ,(acme-dark--height 1)))))
    227   `(org-level-6                ((t (:inherit default :foreground ,header :height ,(acme-dark--height 1)))))
    228   `(org-level-7                ((t (:inherit default :foreground ,header :height ,(acme-dark--height 1)))))
    229   `(org-level-8                ((t (:inherit default :foreground ,header :height ,(acme-dark--height 1)))))
    230   `(org-meta-line              ((t (:inherit fixed-pitch :foreground ,org-meta))))
    231   `(org-document-info-keyword  ((t (:inherit fixed-pitch :foreground ,org-document-info))))
    232   `(org-document-info          ((t (:inherit default :foreground ,org-document-info))))
    233   `(org-verbatim               ((t (:inherit fixed-pitch))))
    234   `(org-table                  ((t (:inherit fixed-pitch :background ,org-table))))
    235   `(org-formula                ((t (:inherit org-table :height ,(acme-dark--height 1)))))
    236   `(org-quote                  ((t (:inherit default :foreground ,org-quote-fg :background ,org-quote-bg))))
    237   `(org-hide                   ((t (:inherit fixed-pitch :foreground ,bg))))
    238   `(org-indent                 ((t (:inherit org-hide))))
    239   `(org-date                   ((t (:inherit fixed-pitch :foreground ,org-date :underline nil))))
    240   `(org-document-title         ((t (:inherit default :foreground ,org-title :height ,(acme-dark--height 1.8) :underline (:color ,org-title-underline)))))
    241   `(org-checkbox               ((t (:inherit fixed-pitch :weight bold :foreground ,org-checkbox))))
    242   `(org-scheduled              ((t (:foreground ,org-scheduled))))
    243   `(org-scheduled-today        ((t (:foreground ,org-scheduled-today))))
    244   `(org-done                   ((t (:inherit fixed-pitch :foreground ,org-done))))
    245   `(org-todo                   ((t (:inherit fixed-pitch :foreground ,org-todo))))
    246   `(org-tag                    ((t (:inherit fixed-pitch :height ,(acme-dark--height 1) :foreground ,org-tag))))
    247   `(org-block-begin-line       ((t (:inherit fixed-pitch :background ,org-block-line))))
    248   `(org-block-end-line         ((t (:inherit fixed-pitch :background ,org-block-line))))
    249   `(org-block                  ((t (:background ,org-block-bg :inherit fixed-pitch))))
    250   `(org-priority               ((t (:inherit fixed-pitch :weight normal))))
    251   `(org-agenda-structure       ((t (:foreground ,org-agenda-structure-fg :background ,org-agenda-structure-bg :overline ,org-agenda-structure-bg :underline ,org-agenda-structure-bg))))
    252   `(org-agenda-date-weekend    ((t (:inherit org-agenda-structure))))
    253   `(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))))
    254   `(org-special-keyword        ((t (:inherit fixed-pitch :foreground ,org-special-keyword))))
    255   `(org-scheduled-previously   ((t (:foreground ,org-sched-prev))))
    256   `(org-agenda-done            ((t (:foreground ,org-agenda-done))))
    257   `(org-footnote               ((t (:foreground ,link))))
    258 
    259   ;; line numbers
    260   `(line-number               ((t (:inherit fixed-pitch :foreground ,linum))))
    261   `(line-number-current-line  ((t (:inherit fixed-pitch :foreground ,linum-hlt))))
    262 
    263   ;; markdown
    264   `(markdown-header-face-1          ((t (:foreground ,header :inherit default :height ,(acme-dark--height 1.5)))))
    265   `(markdown-header-face-2          ((t (:foreground ,header :inherit default :height ,(acme-dark--height 1.4)))))
    266   `(markdown-header-face-3          ((t (:foreground ,header :inherit default :height ,(acme-dark--height 1.3)))))
    267   `(markdown-header-face-4          ((t (:foreground ,header :inherit default :height ,(acme-dark--height 1.23)))))
    268   `(markdown-header-face-5          ((t (:foreground ,header :inherit default :height ,(acme-dark--height 1.23)))))
    269   `(markdown-header-face-6          ((t (:foreground ,header :inherit default :height ,(acme-dark--height 1.23)))))
    270   `(markdown-header-face-7          ((t (:foreground ,header :inherit default :height ,(acme-dark--height 1.23)))))
    271   `(markdown-header-face-8          ((t (:foreground ,header :inherit default :height ,(acme-dark--height 1.23)))))
    272   `(markdown-markup-face            ((t (:inherit fixed-pitch :foreground ,markdown-markup))))
    273   `(markdown-inline-code-face       ((t (:inherit fixed-pitch))))
    274   `(markdown-metadata-key-face      ((t (:inherit fixed-pitch :height ,(acme-dark--height 1) :foreground ,markdown-metadata))))
    275   `(markdown-metadata-value-face    ((t (:inherit fixed-pitch :height ,(acme-dark--height 1) :foreground ,fg))))
    276   `(markdown-language-keyword-face  ((t (:foreground ,markdown-language))))
    277   `(markdown-list-face              ((t (:inherit fixed-pitch :foreground ,markdown-list))))
    278   `(markdown-code-face              ((t (:inherit fixed-pitch :foreground ,fg :background ,markdown-code-bg))))
    279   `(markdown-pre-face               ((t (:inherit fixed-pitch :color ,fg :background ,markdown-pre-bg))))
    280   `(markdown-header-delimiter-face  ((t (:inherit fixed-pitch :foreground ,markdown-header-delimiter))))
    281   `(markdown-header-rule-face       ((t (:inherit fixed-pitch :foreground ,markdown-header-delimiter))))
    282   `(markdown-url-face               ((t (:inherit fixed-pitch :foreground ,link))))
    283 
    284   ;; ivy
    285   `(ivy-current-match            ((t (:inherit fixed-pitch :background ,hlt))))
    286   `(ivy-minibuffer-match-face-1  ((t (:inherit fixed-pitch :foreground ,cyan))))
    287   `(ivy-minibuffer-match-face-2  ((t (:inherit fixed-pitch :foreground ,red))))
    288   `(ivy-minibuffer-match-face-3  ((t (:inherit fixed-pitch :foreground ,blue))))
    289   `(ivy-minibuffer-match-face-4  ((t (:inherit fixed-pitch :foreground ,brown))))
    290 
    291   ;; imenu
    292   `(imenu-list-entry-face-0  ((t (:foreground ,imenu))))
    293   `(imenu-list-entry-face-1  ((t (:foreground ,imenu))))
    294   `(imenu-list-entry-face-2  ((t (:foreground ,imenu))))
    295   `(imenu-list-entry-face-3  ((t (:foreground ,imenu))))
    296   `(imenu-list-entry-face-4  ((t (:foreground ,imenu))))
    297   `(imenu-list-entry-face-5  ((t (:foreground ,imenu))))
    298 
    299   ;; Dired subtree
    300   `(dired-subtree-depth-1-face  ((t (:backround ,bg))))
    301   `(dired-subtree-depth-2-face  ((t (:backround ,bg-light))))
    302   `(dired-subtree-depth-3-face  ((t (:backround ,bg))))
    303   `(dired-subtree-depth-4-face  ((t (:backround ,bg-light))))
    304   `(dired-subtree-depth-5-face  ((t (:backround ,bg))))
    305   `(dired-subtree-depth-6-face  ((t (:backround ,bg-light))))
    306 
    307   ;; Company
    308   `(company-preview-common            ((t (:underline nil))))
    309   `(company-scrollbar-fg              ((t (:background "#388E3C"))))
    310   `(company-tooltip-common            ((t (:inherit fixed-pitch :foreground nil :underline nil :weight bold))))
    311   `(company-tooltip-common            ((t (:underline nil))))
    312   `(company-tooltip-common-selection  ((t (:underline nil))))
    313   `(company-tooltip-selection         ((t (:background "#cee7cf"))))
    314   `(company-tooltip-selection         ((t (:background "#ddffdd"))))
    315 
    316   ;; evil
    317   `(evil-ex-substitute-replacement  ((t (:foreground ,white-light :background ,brown-dark :underline nil))))
    318   `(evil-goggles-delete-face        ((t (:inherit 'lazy-highlight))))
    319   `(evil-goggles-paste-face         ((t (:inherit 'lazy-highlight))))
    320   `(evil-goggles-yank-face          ((t (:inherit 'lazy-highlight)))))
    321 
    322  (custom-theme-set-variables 'acme-dark '(line-spacing 0.4)))))
    323 
    324 ;;;###autoload
    325 (when (and (boundp 'custom-theme-load-path)
    326            load-file-name)
    327   (add-to-list 'custom-theme-load-path
    328                (file-name-as-directory
    329                 (file-name-directory load-file-name))))
    330 
    331 (provide-theme 'acme-dark)
    332 ;;; acme-dark-theme.el ends here