home

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

shortbrain-theme.el (10145B)


      1 ;;; shortbrain-theme.el --- A calm, dark, almost monochrome color theme based on emacs-constant-theme
      2 
      3 ;; Copyright (C) 2020 Vincent Demeester <vincent@sbr.pm>
      4 
      5 ;; Author: Vincent Demeester <vincent@sbr.pm>
      6 ;; Keywords: themes
      7 ;; URL: https://github.com/vdemeester/emacs-config
      8 ;; Version: 2020:03
      9 ;; Package-Requires: ((emacs "24.1"))
     10 
     11 ;; This program is free software; you can redistribute it and/or modify
     12 ;; it under the terms of the GNU General Public License as published by
     13 ;; the Free Software Foundation, either version 3 of the License, or
     14 ;; (at your option) any later version.
     15 
     16 ;; This program is distributed in the hope that it will be useful,
     17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
     18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     19 ;; GNU General Public License for more details.
     20 
     21 ;; You should have received a copy of the GNU General Public License
     22 ;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
     23 
     24 ;;; Commentary:
     25 
     26 ;; To use the shortbrain theme, add the following to your Emacs
     27 ;; configuration file:
     28 ;;
     29 ;;   (load-theme 'shortbrain)
     30 ;;
     31 ;; Requirements: Emacs 24.
     32 
     33 ;;; Code:
     34 
     35 
     36 (deftheme shortbrain "A calm, dark, almost monochrome theme")
     37 
     38 (defconst shortbrain-theme-colors
     39   '(;; Basics
     40     (white . "#ffffff")
     41 
     42     ;; Shades of grey
     43     (default-grey . "#0f1619")
     44     (grey . "#0f1619")
     45     (grey-50 . "#fdfdfe")
     46     (grey-100 . "#f5f8fa")
     47     (grey-200 . "#d8dcde")
     48     (grey-300 . "#bcc0c2")
     49     (grey-400 . "#9fa3a6")
     50     (grey-500 . "#9fa3a6")
     51     (grey-600 . "#656b6e")
     52     (grey-700 . "#494f52")
     53     (grey-720 . "#474d50")
     54     (grey-800 . "#2c3236")
     55     (grey-820 . "#1e2428")
     56     (grey-850 . "#1d2226")
     57     (grey-900 . "#0f1619")
     58 
     59     ;; Priary color shades
     60     (default-primary . "#0be5e5")
     61     (primary . "#0be5e5")
     62     (primary-50 . "#f3fefe")
     63     (primary-100 . "#d4fafa")
     64     (primary-200 . "#91f3f3")
     65     (primary-300 . "#4eecec")
     66     (primary-400 . "#0be5e5")
     67     (primary-500 . "#09cccc")
     68     (primary-600 . "#07b3b3")
     69     (primary-700 . "#059999")
     70     (primary-800 . "#028080")
     71     (primary-900 . "#006666")
     72 
     73     ;; Reds
     74     (default-red. "#f24965")
     75     (red . "#f24965")
     76     (danger . "#f24965")
     77     (red-50 . "#fff0f2")
     78     (red-100 . "#ffd9df")
     79     (red-200 . "#fba9b6")
     80     (red-300 . "#f6798e")
     81     (red-400 . "#f24965")
     82     (red-500 . "#d6455d")
     83     (red-600 . "#ba4054")
     84     (red-700 . "#9e3c4c")
     85     (red-800 . "#823743")
     86     (red-900 . "#66333b")
     87 
     88     ;; Purples
     89     (purple . "#b965e8")))
     90 
     91 
     92 (defun shortbrain-theme-color (name)
     93   "Return the shortbrain theme color with the given NAME."
     94   (cdr (assoc name shortbrain-theme-colors)))
     95 
     96 
     97 (let ((class                    '((class color) (min-colors 256)))
     98       (default-fg               (shortbrain-theme-color 'grey-100))
     99       (default-bg               (shortbrain-theme-color 'grey-900))
    100       (minor-fg                 (shortbrain-theme-color 'grey-700))
    101       (inactive-fg              (shortbrain-theme-color 'grey-600))
    102       (inactive-bg              (shortbrain-theme-color 'grey-800))
    103       (border-fg                (shortbrain-theme-color 'grey-850))
    104       (frame-fg                 (shortbrain-theme-color 'grey-500))
    105       (cursor-fg                (shortbrain-theme-color 'grey-500))
    106       (cursor-bg                (shortbrain-theme-color 'grey-500))
    107 
    108       ;; Scrollbars
    109       (scrollbar-fg             (shortbrain-theme-color 'grey-800))
    110       (scrollbar-bg             (shortbrain-theme-color 'grey-600))
    111 
    112       ;; Highlighting
    113       (highlight-fg             (shortbrain-theme-color 'white))
    114       (highlight-bg             (shortbrain-theme-color 'red))
    115 
    116       ;; Current line
    117       (hl-line-bg               (shortbrain-theme-color 'grey-810))
    118 
    119       ;; Search
    120       (search-fg                (shortbrain-theme-color 'white))
    121       (search-bg                (shortbrain-theme-color 'primary-700))
    122       (search-bg-0              (shortbrain-theme-color 'primary-700))
    123       (search-bg-1              (shortbrain-theme-color 'primary-500))
    124       (search-bg-2              (shortbrain-theme-color 'primary-300))
    125       (search-bg-3              (shortbrain-theme-color 'primary-100))
    126 
    127       ;; Selection
    128       (selection-bg             (shortbrain-theme-color 'grey-800))
    129 
    130       ;; Auto-completion
    131       (completion-fg            (shortbrain-theme-color 'primary))
    132       (completion-bg            (shortbrain-theme-color 'grey-820))
    133       (completion-match-fg      (shortbrain-theme-color 'red-500))
    134       (completion-mouse-fg      (shortbrain-theme-color 'white))
    135       (completion-selection-fg  (shortbrain-theme-color 'white))
    136       (completion-annotation-fg (shortbrain-theme-color 'purple))
    137 
    138       ;; Warnings & errors
    139       (warning-fg               (shortbrain-theme-color 'white))
    140       (warning-bg               (shortbrain-theme-color 'red-600))
    141       (error-fg                 (shortbrain-theme-color 'white))
    142       (error-bg                 (shortbrain-theme-color 'red))
    143 
    144       ;; Language syntax highlighting
    145       (variable-fg              (shortbrain-theme-color 'white))
    146       (function-fg              (shortbrain-theme-color 'grey-200))
    147       (type-fg                  (shortbrain-theme-color 'grey-300))
    148       (constant-fg              (shortbrain-theme-color 'grey-500))
    149       (keyword-fg               (shortbrain-theme-color 'grey-600))
    150       (builtin-fg               (shortbrain-theme-color 'grey-700))
    151       (string-fg                (shortbrain-theme-color 'grey-500))
    152       (doc-fg                   (shortbrain-theme-color 'primary-600)))
    153   (custom-theme-set-faces
    154    'shortbrain
    155 
    156    ;; Regular
    157    `(cursor ((,class (:foreground ,cursor-fg :background ,cursor-bg))))
    158    `(default ((,class (:foreground ,default-fg :background ,default-bg))))
    159    `(default-italic ((,class (:italic t))))
    160 
    161    ;; Emacs UI
    162    `(fringe ((,class (:foreground ,error-fg :background ,default-bg))))
    163    `(header-line ((,class :background ,default-bg)))
    164    `(linum ((,class (:inherit shadow :background ,default-bg))))
    165    `(mode-line ((,class (:foreground ,frame-fg :background ,default-bg
    166                                      :box (:line-width -1 :color ,default-bg)))))
    167    `(mode-line-inactive ((,class (:foreground ,inactive-fg :background ,inactive-bg
    168                                               :box (:line-width -1 :color ,default-bg)))))
    169    `(nlinum-relative-current-face ((,class (:foreground ,frame-fg :background ,default-bg))))
    170    `(vertical-border ((,class (:foreground ,border-fg :background ,default-bg))))
    171    `(tab-bar ((,class (:background ,default-bg))))
    172    `(tab-bar-tab ((,class (:background ,default-bg :inherit shadow :weight bold))))
    173    `(tab-bar-tab-inactive ((,class (:background ,inactive-bg :inherit shadow :weight normal))))
    174 
    175    ;; Highlighting
    176    `(highlight ((,class (:foreground ,highlight-fg :background ,highlight-bg))))
    177    `(hl-line ((,class (:background ,hl-line-bg))))
    178 
    179    ;; Search
    180    `(isearch ((,class (:foreground ,search-fg :background ,search-bg :weight bold))))
    181    `(lazy-highlight ((,class (:foreground ,highlight-fg :background ,highlight-bg) :weight normal)))
    182 
    183    ;; Selection
    184    `(region ((,class (:background ,selection-bg))))
    185 
    186    ;; Erroneous whitespace
    187    `(whitespace-line ((,class (:foreground ,error-fg :background ,error-bg))))
    188    `(whitespace-space ((,class (:foreground ,builtin-fg :background ,hl-line-bg))))
    189    `(whitespace-tab ((,class (:foreground ,builtin-fg :background ,hl-line-bg))))
    190 
    191    ;; Language syntax highlighting
    192    `(font-lock-builtin-face ((,class (:foreground ,builtin-fg))))
    193    `(font-lock-comment-face ((,class (:foreground ,doc-fg))))
    194    `(font-lock-comment-delimiter-face ((,class (:foreground ,minor-fg))))
    195    `(font-lock-constant-face ((,class (:foreground ,constant-fg))))
    196    `(font-lock-doc-face ((,class (:foreground ,doc-fg))))
    197    `(font-lock-function-name-face ((,class (:foreground ,function-fg))))
    198    `(font-lock-keyword-face ((,class (:foreground ,keyword-fg))))
    199    `(font-lock-negation-char-face ((,class (:foreground ,error-fg))))
    200    `(font-lock-preprocessor-face ((,class (:foreground ,builtin-fg))))
    201    `(font-lock-string-face ((,class (:foreground ,string-fg))))
    202    `(font-lock-type-face ((,class (:foreground ,type-fg))))
    203    `(font-lock-variable-name-face ((,class (:foreground ,variable-fg))))
    204    `(font-lock-warning-face ((,class (:foreground ,warning-fg :background ,warning-bg))))
    205 
    206    ;; Avy
    207    `(avy-lead-face   ((,class (:background ,search-bg-0 :foreground ,search-fg))))
    208    `(avy-lead-face-0 ((,class (:background ,search-bg-1 :foreground ,search-fg))))
    209    `(avy-lead-face-1 ((,class (:background ,search-bg-2 :foreground ,search-fg))))
    210    `(avy-lead-face-2 ((,class (:background ,search-bg-3 :foreground ,search-fg))))
    211 
    212    ;; Company (auto-completion)
    213    `(company-preview ((,class (:background ,default-bg :foreground ,completion-match-fg))))
    214    `(company-preview-common ((,class (:background ,completion-bg :foreground ,completion-fg))))
    215    `(company-preview-search ((,class (:background ,completion-bg :foreground ,completion-fg))))
    216    `(company-scrollbar-bg ((,class (:background ,scrollbar-bg))))
    217    `(company-scrollbar-fg ((,class (:background ,scrollbar-fg))))
    218    `(company-tooltip ((,class (:background ,completion-bg :foreground ,completion-fg))))
    219    `(company-tooltip-annotation ((,class (:foreground ,completion-annotation-fg))))
    220    `(company-tooltip-common ((,class (:background nil :foreground ,completion-match-fg))))
    221    `(company-tooltip-common-selection ((,class (:foreground ,completion-selection-fg))))
    222    `(company-tooltip-mouse ((,class (:background ,selection-bg :foreground ,completion-mouse-fg))))
    223    `(company-tooltip-search ((,class (:foreground ,completion-match-fg))))
    224    `(company-tooltip-selection ((,class (:background ,selection-bg :foreground nil))))))
    225 
    226 
    227 ;;;###autoload
    228 (when (and (boundp 'custom-theme-load-path)
    229            load-file-name)
    230   ;; add theme folder to `custom-theme-load-path' when installing over MELPA
    231   (add-to-list 'custom-theme-load-path
    232                (file-name-as-directory (file-name-directory load-file-name))))
    233 
    234 
    235 (provide-theme 'shortbrain)
    236 (provide 'shortbrain-theme)
    237 
    238 
    239 ;;; shortbrain-theme.el ends here