dotemacs

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

modus-operandi-theme.el (14972B)


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