dotemacs

My Emacs configuration
git clone git://git.entf.net/dotemacs
Log | Files | Refs | LICENSE

modus-operandi-theme.el (14258B)


      1 ;;; modus-operandi-theme.el --- Elegant, highly legible theme with a white background -*- lexical-binding:t -*-
      2 
      3 ;; Copyright (C) 2019-2023  Free Software Foundation, Inc.
      4 
      5 ;; Author: Protesilaos Stavrou <info@protesilaos.com>
      6 ;; Maintainer: Modus-Themes Development <~protesilaos/modus-themes@lists.sr.ht>
      7 ;; URL: https://git.sr.ht/~protesilaos/modus-themes
      8 ;; Mailing-List: https://lists.sr.ht/~protesilaos/modus-themes
      9 ;; Keywords: faces, theme, accessibility
     10 
     11 ;; This file is part of GNU Emacs.
     12 
     13 ;; GNU Emacs is free software: you can redistribute it and/or modify
     14 ;; it under the terms of the GNU General Public License as published by
     15 ;; the Free Software Foundation, either version 3 of the License, or
     16 ;; (at your option) any later version.
     17 ;;
     18 ;; GNU Emacs is distributed in the hope that it will be useful,
     19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
     20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     21 ;; GNU General Public License for more details.
     22 ;;
     23 ;; You should have received a copy of the GNU General Public License
     24 ;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
     25 
     26 ;;; Commentary:
     27 ;;
     28 ;; The Modus themes conform with the highest standard for
     29 ;; color-contrast accessibility between background and foreground
     30 ;; values (WCAG AAA).  Please refer to the official Info manual for
     31 ;; further documentation (distributed with the themes, or available
     32 ;; at: <https://protesilaos.com/emacs/modus-themes>).
     33 
     34 ;;; Code:
     35 
     36 
     37 
     38 (eval-and-compile
     39   (unless (and (fboundp 'require-theme)
     40                load-file-name
     41                (equal (file-name-directory load-file-name)
     42                       (expand-file-name "themes/" data-directory))
     43                (require-theme 'modus-themes t))
     44     (require 'modus-themes))
     45 
     46 ;;;###theme-autoload
     47   (deftheme modus-operandi
     48     "Elegant, highly legible theme with a white background.
     49 Conforms with the highest legibility standard for color contrast
     50 between background and foreground in any given piece of text,
     51 which corresponds to a minimum contrast in relative luminance of
     52 7:1 (WCAG AAA standard)."
     53     :background-mode 'light
     54     :kind 'color-scheme
     55     :family 'modus)
     56 
     57   (defconst modus-operandi-palette
     58     '(
     59 ;;; Basic values
     60 
     61       (bg-main          "#ffffff")
     62       (bg-dim           "#f2f2f2")
     63       (fg-main          "#000000")
     64       (fg-dim           "#595959")
     65       (fg-alt           "#193668")
     66       (bg-active        "#c4c4c4")
     67       (bg-inactive      "#e0e0e0")
     68       (border           "#9f9f9f")
     69 
     70 ;;; Common accent foregrounds
     71 
     72       (red             "#a60000")
     73       (red-warmer      "#972500")
     74       (red-cooler      "#a0132f")
     75       (red-faint       "#7f0000")
     76       (red-intense     "#d00000")
     77       (green           "#006800")
     78       (green-warmer    "#316500")
     79       (green-cooler    "#00663f")
     80       (green-faint     "#2a5045")
     81       (green-intense   "#008900")
     82       (yellow          "#6f5500")
     83       (yellow-warmer   "#884900")
     84       (yellow-cooler   "#7a4f2f")
     85       (yellow-faint    "#624416")
     86       (yellow-intense  "#808000")
     87       (blue            "#0031a9")
     88       (blue-warmer     "#3548cf")
     89       (blue-cooler     "#0000b0")
     90       (blue-faint      "#003497")
     91       (blue-intense    "#0000ff")
     92       (magenta         "#721045")
     93       (magenta-warmer  "#8f0075")
     94       (magenta-cooler  "#531ab6")
     95       (magenta-faint   "#7c318f")
     96       (magenta-intense "#dd22dd")
     97       (cyan            "#005e8b")
     98       (cyan-warmer     "#3f578f")
     99       (cyan-cooler     "#005f5f")
    100       (cyan-faint      "#005077")
    101       (cyan-intense    "#008899")
    102 
    103 ;;; Uncommon accent foregrounds
    104 
    105       (rust       "#8a290f")
    106       (gold       "#80601f")
    107       (olive      "#56692d")
    108       (slate      "#2f3f83")
    109       (indigo     "#4a3a8a")
    110       (maroon     "#731c52")
    111       (pink       "#7b435c")
    112 
    113 ;;; Common accent backgrounds
    114 
    115       (bg-red-intense     "#ff8f88")
    116       (bg-green-intense   "#8adf80")
    117       (bg-yellow-intense  "#f3d000")
    118       (bg-blue-intense    "#bfc9ff")
    119       (bg-magenta-intense "#dfa0f0")
    120       (bg-cyan-intense    "#a4d5f9")
    121 
    122       (bg-red-subtle      "#ffcfbf")
    123       (bg-green-subtle    "#b3fabf")
    124       (bg-yellow-subtle   "#fff576")
    125       (bg-blue-subtle     "#ccdfff")
    126       (bg-magenta-subtle  "#ffddff")
    127       (bg-cyan-subtle     "#bfefff")
    128 
    129       (bg-red-nuanced     "#fff1f0")
    130       (bg-green-nuanced   "#ecf7ed")
    131       (bg-yellow-nuanced  "#fff3da")
    132       (bg-blue-nuanced    "#f3f3ff")
    133       (bg-magenta-nuanced "#fdf0ff")
    134       (bg-cyan-nuanced    "#ebf6fa")
    135 
    136 ;;; Uncommon accent backgrounds
    137 
    138       (bg-ochre    "#f0e0cc")
    139       (bg-lavender "#dfdbfa")
    140       (bg-sage     "#c0e7d4")
    141 
    142 ;;; Graphs
    143 
    144       (bg-graph-red-0     "#ef7969")
    145       (bg-graph-red-1     "#ffaab4")
    146       (bg-graph-green-0   "#2fe029")
    147       (bg-graph-green-1   "#75ef30")
    148       (bg-graph-yellow-0  "#ffcf00")
    149       (bg-graph-yellow-1  "#f9ff00")
    150       (bg-graph-blue-0    "#7f90ff")
    151       (bg-graph-blue-1    "#9fc6ff")
    152       (bg-graph-magenta-0 "#e07fff")
    153       (bg-graph-magenta-1 "#fad0ff")
    154       (bg-graph-cyan-0    "#70d3f0")
    155       (bg-graph-cyan-1    "#afefff")
    156 
    157 ;;; Special purpose
    158 
    159       (bg-completion       "#c0deff")
    160       (bg-hover            "#b2e4dc")
    161       (bg-hover-secondary  "#f5d0a0")
    162       (bg-hl-line          "#dae5ec")
    163       (bg-region           "#bdbdbd")
    164       (fg-region           "#000000")
    165 
    166       (bg-char-0 "#7feaff")
    167       (bg-char-1 "#ffaaff")
    168       (bg-char-2 "#dff000")
    169 
    170       (bg-mode-line-active        "#c8c8c8")
    171       (fg-mode-line-active        "#000000")
    172       (border-mode-line-active    "#5a5a5a")
    173       (bg-mode-line-inactive      "#e6e6e6")
    174       (fg-mode-line-inactive      "#585858")
    175       (border-mode-line-inactive  "#a3a3a3")
    176 
    177       (modeline-err     "#7f0000")
    178       (modeline-warning "#5f0070")
    179       (modeline-info    "#002580")
    180 
    181       (bg-tab-bar      "#dfdfdf")
    182       (bg-tab-current  "#ffffff")
    183       (bg-tab-other    "#c2c2c2")
    184 
    185 ;;; Diffs
    186 
    187       (bg-added           "#c1f2d1")
    188       (bg-added-faint     "#d8f8e1")
    189       (bg-added-refine    "#aee5be")
    190       (bg-added-fringe    "#6cc06c")
    191       (fg-added           "#005000")
    192       (fg-added-intense   "#006700")
    193 
    194       (bg-changed         "#ffdfa9")
    195       (bg-changed-faint   "#ffefbf")
    196       (bg-changed-refine  "#fac090")
    197       (bg-changed-fringe  "#d7c20a")
    198       (fg-changed         "#553d00")
    199       (fg-changed-intense "#655000")
    200 
    201       (bg-removed         "#ffd8d5")
    202       (bg-removed-faint   "#ffe9e9")
    203       (bg-removed-refine  "#f3b5af")
    204       (bg-removed-fringe  "#d84a4f")
    205       (fg-removed         "#8f1313")
    206       (fg-removed-intense "#aa2222")
    207 
    208       (bg-diff-context    "#f3f3f3")
    209 
    210 ;;; Paren match
    211 
    212       (bg-paren-match        "#5fcfff")
    213       (bg-paren-expression   "#efd3f5")
    214       (underline-paren-match unspecified)
    215 
    216 ;;; Mappings
    217 
    218 ;;;; General mappings
    219 
    220       (fringe bg-dim)
    221       (cursor fg-main)
    222 
    223       (keybind blue-cooler)
    224       (name magenta)
    225       (identifier yellow-cooler)
    226 
    227       (err red)
    228       (warning yellow-warmer)
    229       (info cyan-cooler)
    230 
    231       (underline-err red-intense)
    232       (underline-warning yellow-intense)
    233       (underline-note cyan-intense)
    234 
    235       (bg-prominent-err bg-red-intense)
    236       (fg-prominent-err fg-main)
    237       (bg-prominent-warning bg-yellow-intense)
    238       (fg-prominent-warning fg-main)
    239       (bg-prominent-note bg-cyan-intense)
    240       (fg-prominent-note fg-main)
    241 
    242 ;;;; Code mappings
    243 
    244       (builtin magenta-warmer)
    245       (comment fg-dim)
    246       (constant blue-cooler)
    247       (docstring green-faint)
    248       (docmarkup magenta-faint)
    249       (fnname magenta)
    250       (keyword magenta-cooler)
    251       (preprocessor red-cooler)
    252       (string blue-warmer)
    253       (type cyan-cooler)
    254       (variable cyan)
    255       (rx-construct green-cooler)
    256       (rx-backslash magenta)
    257 
    258 ;;;; Accent mappings
    259 
    260       (accent-0 blue)
    261       (accent-1 magenta-warmer)
    262       (accent-2 cyan)
    263       (accent-3 red)
    264 
    265 ;;;; Button mappings
    266 
    267       (fg-button-active fg-main)
    268       (fg-button-inactive fg-dim)
    269       (bg-button-active bg-active)
    270       (bg-button-inactive bg-dim)
    271 
    272 ;;;; Completion mappings
    273 
    274       (fg-completion-match-0 blue)
    275       (fg-completion-match-1 magenta-warmer)
    276       (fg-completion-match-2 cyan)
    277       (fg-completion-match-3 red)
    278       (bg-completion-match-0 unspecified)
    279       (bg-completion-match-1 unspecified)
    280       (bg-completion-match-2 unspecified)
    281       (bg-completion-match-3 unspecified)
    282 
    283 ;;;; Date mappings
    284 
    285       (date-common cyan)
    286       (date-deadline red)
    287       (date-event fg-alt)
    288       (date-holiday red-cooler)
    289       (date-holiday-other blue)
    290       (date-now fg-main)
    291       (date-range fg-alt)
    292       (date-scheduled yellow-warmer)
    293       (date-weekday cyan)
    294       (date-weekend red-faint)
    295 
    296 ;;;; Line number mappings
    297 
    298       (fg-line-number-inactive fg-dim)
    299       (fg-line-number-active fg-main)
    300       (bg-line-number-inactive bg-dim)
    301       (bg-line-number-active bg-active)
    302 
    303 ;;;; Link mappings
    304 
    305       (fg-link blue-warmer)
    306       (bg-link unspecified)
    307       (underline-link blue-warmer)
    308 
    309       (fg-link-symbolic cyan)
    310       (bg-link-symbolic unspecified)
    311       (underline-link-symbolic cyan)
    312 
    313       (fg-link-visited magenta)
    314       (bg-link-visited unspecified)
    315       (underline-link-visited magenta)
    316 
    317 ;;;; Mail mappings
    318 
    319       (mail-cite-0 blue-faint)
    320       (mail-cite-1 yellow-warmer)
    321       (mail-cite-2 cyan-cooler)
    322       (mail-cite-3 red-cooler)
    323       (mail-part cyan)
    324       (mail-recipient magenta-cooler)
    325       (mail-subject magenta-warmer)
    326       (mail-other magenta-faint)
    327 
    328 ;;;; Mark mappings
    329 
    330       (bg-mark-delete bg-red-subtle)
    331       (fg-mark-delete red)
    332       (bg-mark-select bg-cyan-subtle)
    333       (fg-mark-select cyan)
    334       (bg-mark-other bg-yellow-subtle)
    335       (fg-mark-other yellow)
    336 
    337 ;;;; Prompt mappings
    338 
    339       (fg-prompt cyan-cooler)
    340       (bg-prompt unspecified)
    341 
    342 ;;;; Prose mappings
    343 
    344       (prose-block fg-dim)
    345       (prose-code green-cooler)
    346       (prose-done green)
    347       (prose-macro magenta-cooler)
    348       (prose-metadata fg-dim)
    349       (prose-metadata-value fg-alt)
    350       (prose-table fg-alt)
    351       (prose-tag magenta-faint)
    352       (prose-todo red)
    353       (prose-verbatim magenta-warmer)
    354 
    355 ;;;; Rainbow mappings
    356 
    357       (rainbow-0 fg-main)
    358       (rainbow-1 magenta-intense)
    359       (rainbow-2 cyan-intense)
    360       (rainbow-3 red-warmer)
    361       (rainbow-4 yellow-intense)
    362       (rainbow-5 magenta-cooler)
    363       (rainbow-6 green-intense)
    364       (rainbow-7 blue-warmer)
    365       (rainbow-8 magenta-warmer)
    366 
    367 ;;;; Space mappings
    368 
    369       (bg-space unspecified)
    370       (fg-space border)
    371       (bg-space-err bg-red-intense)
    372 
    373 ;;;; Terminal mappings
    374 
    375       (bg-term-black           "black")
    376       (fg-term-black           "black")
    377       (bg-term-black-bright    "gray35")
    378       (fg-term-black-bright    "gray35")
    379 
    380       (bg-term-red             red)
    381       (fg-term-red             red)
    382       (bg-term-red-bright      red-warmer)
    383       (fg-term-red-bright      red-warmer)
    384 
    385       (bg-term-green           green)
    386       (fg-term-green           green)
    387       (bg-term-green-bright    green-cooler)
    388       (fg-term-green-bright    green-cooler)
    389 
    390       (bg-term-yellow          yellow)
    391       (fg-term-yellow          yellow)
    392       (bg-term-yellow-bright   yellow-warmer)
    393       (fg-term-yellow-bright   yellow-warmer)
    394 
    395       (bg-term-blue            blue)
    396       (fg-term-blue            blue)
    397       (bg-term-blue-bright     blue-warmer)
    398       (fg-term-blue-bright     blue-warmer)
    399 
    400       (bg-term-magenta         magenta)
    401       (fg-term-magenta         magenta)
    402       (bg-term-magenta-bright  magenta-cooler)
    403       (fg-term-magenta-bright  magenta-cooler)
    404 
    405       (bg-term-cyan            cyan)
    406       (fg-term-cyan            cyan)
    407       (bg-term-cyan-bright     cyan-cooler)
    408       (fg-term-cyan-bright     cyan-cooler)
    409 
    410       (bg-term-white           "gray65")
    411       (fg-term-white           "gray65")
    412       (bg-term-white-bright    "white")
    413       (fg-term-white-bright    "white")
    414 
    415 ;;;; Heading mappings
    416 
    417       (fg-heading-0 cyan-cooler)
    418       (fg-heading-1 fg-main)
    419       (fg-heading-2 yellow-faint)
    420       (fg-heading-3 fg-alt)
    421       (fg-heading-4 magenta)
    422       (fg-heading-5 green-faint)
    423       (fg-heading-6 red-faint)
    424       (fg-heading-7 cyan-warmer)
    425       (fg-heading-8 fg-dim)
    426 
    427       (bg-heading-0 unspecified)
    428       (bg-heading-1 unspecified)
    429       (bg-heading-2 unspecified)
    430       (bg-heading-3 unspecified)
    431       (bg-heading-4 unspecified)
    432       (bg-heading-5 unspecified)
    433       (bg-heading-6 unspecified)
    434       (bg-heading-7 unspecified)
    435       (bg-heading-8 unspecified)
    436 
    437       (overline-heading-0 unspecified)
    438       (overline-heading-1 unspecified)
    439       (overline-heading-2 unspecified)
    440       (overline-heading-3 unspecified)
    441       (overline-heading-4 unspecified)
    442       (overline-heading-5 unspecified)
    443       (overline-heading-6 unspecified)
    444       (overline-heading-7 unspecified)
    445       (overline-heading-8 unspecified))
    446     "The entire palette of the `modus-operandi' theme.
    447 
    448 Named colors have the form (COLOR-NAME HEX-VALUE) with the former
    449 as a symbol and the latter as a string.
    450 
    451 Semantic color mappings have the form (MAPPING-NAME COLOR-NAME)
    452 with both as symbols.  The latter is a named color that already
    453 exists in the palette and is associated with a HEX-VALUE.")
    454 
    455   (defcustom modus-operandi-palette-overrides nil
    456     "Overrides for `modus-operandi-palette'.
    457 
    458 Mirror the elements of the aforementioned palette, overriding
    459 their value.
    460 
    461 For overrides that are shared across all of the Modus themes,
    462 refer to `modus-themes-common-palette-overrides'.
    463 
    464 Theme-specific overrides take precedence over shared overrides.
    465 The idea of common overrides is to change semantic color
    466 mappings, such as to make the cursor red.  Wherea theme-specific
    467 overrides can also be used to change the value of a named color,
    468 such as what hexadecimal RGB value the red-warmer symbol
    469 represents."
    470     :group 'modus-themes
    471     :package-version '(modus-themes . "4.0.0")
    472     :version "30.1"
    473     :type '(repeat (list symbol (choice symbol string)))
    474     :set #'modus-themes--set-option
    475     :initialize #'custom-initialize-default
    476     :link '(info-link "(modus-themes) Palette overrides"))
    477 
    478   (modus-themes-theme modus-operandi
    479                       modus-operandi-palette
    480                       modus-operandi-palette-overrides)
    481 
    482   (provide-theme 'modus-operandi))
    483 
    484 ;;; modus-operandi-theme.el ends here