dotemacs

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

modus-operandi-deuteranopia-theme.el (14517B)


      1 ;;; modus-operandi-deuteranopia-theme.el --- Deuteranopia-optimized 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-deuteranopia
     48     "Deuteranopia-optimized theme with a white background.
     49 This variant is optimized for users with red-green color
     50 deficiency (deuteranopia).  It conforms with the highest
     51 legibility standard for color contrast between background and
     52 foreground in any given piece of text, which corresponds to a
     53 minimum contrast in relative luminance of 7:1 (WCAG AAA
     54 standard)."
     55     :background-mode 'light
     56     :kind 'color-scheme
     57     :family 'modus)
     58 
     59   (defconst modus-operandi-deuteranopia-palette
     60     '(
     61 ;;; Basic values
     62 
     63       (bg-main          "#ffffff")
     64       (bg-dim           "#f2f2f2")
     65       (fg-main          "#000000")
     66       (fg-dim           "#595959")
     67       (fg-alt           "#193668")
     68       (bg-active        "#c4c4c4")
     69       (bg-inactive      "#e0e0e0")
     70       (border           "#9f9f9f")
     71 
     72 ;;; Common accent foregrounds
     73 
     74       (red             "#a60000")
     75       (red-warmer      "#972500")
     76       (red-cooler      "#a0132f")
     77       (red-faint       "#7f0000")
     78       (red-intense     "#d00000")
     79       (green           "#006800")
     80       (green-warmer    "#316500")
     81       (green-cooler    "#00663f")
     82       (green-faint     "#2a5045")
     83       (green-intense   "#008900")
     84       (yellow          "#695500")
     85       (yellow-warmer   "#973300")
     86       (yellow-cooler   "#77492f")
     87       (yellow-faint    "#624416")
     88       (yellow-intense  "#808000")
     89       (blue            "#0031a9")
     90       (blue-warmer     "#3548cf")
     91       (blue-cooler     "#0000b0")
     92       (blue-faint      "#003497")
     93       (blue-intense    "#0000ff")
     94       (magenta         "#721045")
     95       (magenta-warmer  "#8f0075")
     96       (magenta-cooler  "#531ab6")
     97       (magenta-faint   "#7c318f")
     98       (magenta-intense "#dd22dd")
     99       (cyan            "#005e8b")
    100       (cyan-warmer     "#3f578f")
    101       (cyan-cooler     "#005f5f")
    102       (cyan-faint      "#005077")
    103       (cyan-intense    "#008899")
    104 
    105 ;;; Uncommon accent foregrounds
    106 
    107       (rust       "#8a290f")
    108       (gold       "#80601f")
    109       (olive      "#56692d")
    110       (slate      "#2f3f83")
    111       (indigo     "#4a3a8a")
    112       (maroon     "#731c52")
    113       (pink       "#7b435c")
    114 
    115 ;;; Common accent backgrounds
    116 
    117       (bg-red-intense     "#ff8f88")
    118       (bg-green-intense   "#8adf80")
    119       (bg-yellow-intense  "#f3d000")
    120       (bg-blue-intense    "#bfc9ff")
    121       (bg-magenta-intense "#dfa0f0")
    122       (bg-cyan-intense    "#a4d5f9")
    123 
    124       (bg-red-subtle      "#ffcfbf")
    125       (bg-green-subtle    "#b3fabf")
    126       (bg-yellow-subtle   "#fff576")
    127       (bg-blue-subtle     "#ccdfff")
    128       (bg-magenta-subtle  "#ffddff")
    129       (bg-cyan-subtle     "#bfefff")
    130 
    131       (bg-red-nuanced     "#fff1f0")
    132       (bg-green-nuanced   "#ecf7ed")
    133       (bg-yellow-nuanced  "#fff3da")
    134       (bg-blue-nuanced    "#f3f3ff")
    135       (bg-magenta-nuanced "#fdf0ff")
    136       (bg-cyan-nuanced    "#ebf6fa")
    137 
    138 ;;; Uncommon accent backgrounds
    139 
    140       (bg-ochre    "#f0e0cc")
    141       (bg-lavender "#dfdbfa")
    142       (bg-sage     "#c0e7d4")
    143 
    144 ;;; Graphs
    145 
    146       (bg-graph-red-0     "#d0b029")
    147       (bg-graph-red-1     "#e0cab4")
    148       (bg-graph-green-0   "#8ad080")
    149       (bg-graph-green-1   "#afdfa5")
    150       (bg-graph-yellow-0  "#ffcf00")
    151       (bg-graph-yellow-1  "#f9ff00")
    152       (bg-graph-blue-0    "#7f9fff")
    153       (bg-graph-blue-1    "#9fc6ff")
    154       (bg-graph-magenta-0 "#b0b0d0")
    155       (bg-graph-magenta-1 "#d0dfdf")
    156       (bg-graph-cyan-0    "#6faad9")
    157       (bg-graph-cyan-1    "#bfe0ff")
    158 
    159 ;;; Special purpose
    160 
    161       (bg-completion       "#c0deff")
    162       (bg-hover            "#b2e4dc")
    163       (bg-hover-secondary  "#f5d0a0")
    164       (bg-hl-line          "#dae5ec")
    165       (bg-region           "#bdbdbd")
    166       (fg-region           "#000000")
    167 
    168       (bg-char-0 "#7feaff")
    169       (bg-char-1 "#ffaaff")
    170       (bg-char-2 "#dff000")
    171 
    172       (bg-mode-line-active        "#d0d6ff")
    173       (fg-mode-line-active        "#0f0f0f")
    174       (border-mode-line-active    "#4f4f74")
    175       (bg-mode-line-inactive      "#e6e6e6")
    176       (fg-mode-line-inactive      "#585858")
    177       (border-mode-line-inactive  "#a3a3a3")
    178 
    179       (modeline-err     "#603a00")
    180       (modeline-warning "#454500")
    181       (modeline-info    "#023d92")
    182 
    183       (bg-tab-bar      "#dfdfdf")
    184       (bg-tab-current  "#ffffff")
    185       (bg-tab-other    "#c2c2c2")
    186 
    187 ;;; Diffs
    188 
    189       (bg-added           "#d5d7ff")
    190       (bg-added-faint     "#e6e6ff")
    191       (bg-added-refine    "#babcef")
    192       (bg-added-fringe    "#275acc")
    193       (fg-added           "#303099")
    194       (fg-added-intense   "#0303cc")
    195 
    196       (bg-changed         "#eecfdf")
    197       (bg-changed-faint   "#f0dde5")
    198       (bg-changed-refine  "#e0b0d0")
    199       (bg-changed-fringe  "#9f6ab0")
    200       (fg-changed         "#6f1343")
    201       (fg-changed-intense "#7f0f9f")
    202 
    203       (bg-removed         "#f4f099")
    204       (bg-removed-faint   "#f6f6b7")
    205       (bg-removed-refine  "#ede06f")
    206       (bg-removed-fringe  "#c0b200")
    207       (fg-removed         "#553d00")
    208       (fg-removed-intense "#7f6f00")
    209 
    210       (bg-diff-context    "#f3f3f3")
    211 
    212 ;;; Paren match
    213 
    214       (bg-paren-match        "#5fcfff")
    215       (bg-paren-expression   "#efd3f5")
    216       (underline-paren-match unspecified)
    217 
    218 ;;; Mappings
    219 
    220 ;;;; General mappings
    221 
    222       (fringe bg-dim)
    223       (cursor blue-intense)
    224 
    225       (keybind blue-cooler)
    226       (name blue-cooler)
    227       (identifier yellow-faint)
    228 
    229       (err yellow-warmer)
    230       (warning yellow)
    231       (info blue)
    232 
    233       (underline-err yellow-intense)
    234       (underline-warning magenta-faint)
    235       (underline-note cyan)
    236 
    237       (bg-prominent-err bg-yellow-intense)
    238       (fg-prominent-err fg-main)
    239       (bg-prominent-warning bg-magenta-intense)
    240       (fg-prominent-warning fg-main)
    241       (bg-prominent-note bg-cyan-intense)
    242       (fg-prominent-note fg-main)
    243 
    244 ;;;; Code mappings
    245 
    246       (builtin magenta-warmer)
    247       (comment yellow-cooler)
    248       (constant blue-cooler)
    249       (docstring green-faint)
    250       (docmarkup magenta-faint)
    251       (fnname magenta)
    252       (keyword magenta-cooler)
    253       (preprocessor red-cooler)
    254       (string blue-warmer)
    255       (type cyan-cooler)
    256       (variable cyan)
    257       (rx-construct yellow-cooler)
    258       (rx-backslash blue-cooler)
    259 
    260 ;;;; Accent mappings
    261 
    262       (accent-0 blue)
    263       (accent-1 yellow-warmer)
    264       (accent-2 cyan)
    265       (accent-3 magenta-cooler)
    266 
    267 ;;;; Button mappings
    268 
    269       (fg-button-active fg-main)
    270       (fg-button-inactive fg-dim)
    271       (bg-button-active bg-active)
    272       (bg-button-inactive bg-dim)
    273 
    274 ;;;; Completion mappings
    275 
    276       (fg-completion-match-0 blue)
    277       (fg-completion-match-1 yellow-warmer)
    278       (fg-completion-match-2 cyan)
    279       (fg-completion-match-3 magenta-cooler)
    280       (bg-completion-match-0 unspecified)
    281       (bg-completion-match-1 unspecified)
    282       (bg-completion-match-2 unspecified)
    283       (bg-completion-match-3 unspecified)
    284 
    285 ;;;; Date mappings
    286 
    287       (date-common cyan)
    288       (date-deadline yellow-warmer)
    289       (date-event fg-alt)
    290       (date-holiday yellow-warmer)
    291       (date-holiday-other blue)
    292       (date-now blue-faint)
    293       (date-range fg-alt)
    294       (date-scheduled yellow-cooler)
    295       (date-weekday cyan)
    296       (date-weekend yellow-faint)
    297 
    298 ;;;; Line number mappings
    299 
    300       (fg-line-number-inactive fg-dim)
    301       (fg-line-number-active fg-main)
    302       (bg-line-number-inactive bg-dim)
    303       (bg-line-number-active bg-active)
    304 
    305 ;;;; Link mappings
    306 
    307       (fg-link blue-warmer)
    308       (bg-link unspecified)
    309       (underline-link blue-warmer)
    310 
    311       (fg-link-symbolic cyan)
    312       (bg-link-symbolic unspecified)
    313       (underline-link-symbolic cyan)
    314 
    315       (fg-link-visited yellow-faint)
    316       (bg-link-visited unspecified)
    317       (underline-link-visited yellow-faint)
    318 
    319 ;;;; Mail mappings
    320 
    321       (mail-cite-0 blue-warmer)
    322       (mail-cite-1 yellow)
    323       (mail-cite-2 cyan-faint)
    324       (mail-cite-3 yellow-faint)
    325       (mail-part blue)
    326       (mail-recipient blue)
    327       (mail-subject yellow-cooler)
    328       (mail-other cyan-faint)
    329 
    330 ;;;; Mark mappings
    331 
    332       (bg-mark-delete bg-yellow-subtle)
    333       (fg-mark-delete yellow)
    334       (bg-mark-select bg-cyan-subtle)
    335       (fg-mark-select cyan)
    336       (bg-mark-other bg-magenta-subtle)
    337       (fg-mark-other magenta)
    338 
    339 ;;;; Prompt mappings
    340 
    341       (fg-prompt blue)
    342       (bg-prompt unspecified)
    343 
    344 ;;;; Prose mappings
    345 
    346       (prose-block fg-dim)
    347       (prose-code cyan-cooler)
    348       (prose-done blue)
    349       (prose-macro magenta-cooler)
    350       (prose-metadata fg-dim)
    351       (prose-metadata-value fg-alt)
    352       (prose-table fg-alt)
    353       (prose-tag magenta-faint)
    354       (prose-todo yellow-warmer)
    355       (prose-verbatim magenta-warmer)
    356 
    357 ;;;; Rainbow mappings
    358 
    359       (rainbow-0 blue)
    360       (rainbow-1 yellow)
    361       (rainbow-2 blue-warmer)
    362       (rainbow-3 yellow-cooler)
    363       (rainbow-4 blue-cooler)
    364       (rainbow-5 yellow-warmer)
    365       (rainbow-6 blue-faint)
    366       (rainbow-7 yellow-faint)
    367       (rainbow-8 cyan)
    368 
    369 ;;;; Space mappings
    370 
    371       (bg-space unspecified)
    372       (fg-space border)
    373       (bg-space-err bg-yellow-intense)
    374 
    375 ;;;; Terminal mappings
    376 
    377       (bg-term-black           "black")
    378       (fg-term-black           "black")
    379       (bg-term-black-bright    "gray35")
    380       (fg-term-black-bright    "gray35")
    381 
    382       (bg-term-red             red)
    383       (fg-term-red             red)
    384       (bg-term-red-bright      red-warmer)
    385       (fg-term-red-bright      red-warmer)
    386 
    387       (bg-term-green           green)
    388       (fg-term-green           green)
    389       (bg-term-green-bright    green-cooler)
    390       (fg-term-green-bright    green-cooler)
    391 
    392       (bg-term-yellow          yellow)
    393       (fg-term-yellow          yellow)
    394       (bg-term-yellow-bright   yellow-warmer)
    395       (fg-term-yellow-bright   yellow-warmer)
    396 
    397       (bg-term-blue            blue)
    398       (fg-term-blue            blue)
    399       (bg-term-blue-bright     blue-warmer)
    400       (fg-term-blue-bright     blue-warmer)
    401 
    402       (bg-term-magenta         magenta)
    403       (fg-term-magenta         magenta)
    404       (bg-term-magenta-bright  magenta-cooler)
    405       (fg-term-magenta-bright  magenta-cooler)
    406 
    407       (bg-term-cyan            cyan)
    408       (fg-term-cyan            cyan)
    409       (bg-term-cyan-bright     cyan-cooler)
    410       (fg-term-cyan-bright     cyan-cooler)
    411 
    412       (bg-term-white           "gray65")
    413       (fg-term-white           "gray65")
    414       (bg-term-white-bright    "white")
    415       (fg-term-white-bright    "white")
    416 
    417 ;;;; Heading mappings
    418 
    419       (fg-heading-0 cyan-cooler)
    420       (fg-heading-1 fg-main)
    421       (fg-heading-2 yellow-faint)
    422       (fg-heading-3 fg-alt)
    423       (fg-heading-4 magenta)
    424       (fg-heading-5 green-faint)
    425       (fg-heading-6 red-faint)
    426       (fg-heading-7 cyan-warmer)
    427       (fg-heading-8 fg-dim)
    428 
    429       (bg-heading-0 unspecified)
    430       (bg-heading-1 unspecified)
    431       (bg-heading-2 unspecified)
    432       (bg-heading-3 unspecified)
    433       (bg-heading-4 unspecified)
    434       (bg-heading-5 unspecified)
    435       (bg-heading-6 unspecified)
    436       (bg-heading-7 unspecified)
    437       (bg-heading-8 unspecified)
    438 
    439       (overline-heading-0 unspecified)
    440       (overline-heading-1 unspecified)
    441       (overline-heading-2 unspecified)
    442       (overline-heading-3 unspecified)
    443       (overline-heading-4 unspecified)
    444       (overline-heading-5 unspecified)
    445       (overline-heading-6 unspecified)
    446       (overline-heading-7 unspecified)
    447       (overline-heading-8 unspecified))
    448     "The entire palette of the `modus-operandi-deuteranopia' theme.
    449 
    450 Named colors have the form (COLOR-NAME HEX-VALUE) with the former
    451 as a symbol and the latter as a string.
    452 
    453 Semantic color mappings have the form (MAPPING-NAME COLOR-NAME)
    454 with both as symbols.  The latter is a named color that already
    455 exists in the palette and is associated with a HEX-VALUE.")
    456 
    457   (defcustom modus-operandi-deuteranopia-palette-overrides nil
    458     "Overrides for `modus-operandi-deuteranopia-palette'.
    459 
    460 Mirror the elements of the aforementioned palette, overriding
    461 their value.
    462 
    463 For overrides that are shared across all of the Modus themes,
    464 refer to `modus-themes-common-palette-overrides'.
    465 
    466 Theme-specific overrides take precedence over shared overrides.
    467 The idea of common overrides is to change semantic color
    468 mappings, such as to make the cursor red.  Wherea theme-specific
    469 overrides can also be used to change the value of a named color,
    470 such as what hexadecimal RGB value the red-warmer symbol
    471 represents."
    472     :group 'modus-themes
    473     :package-version '(modus-themes . "4.0.0")
    474     :version "30.1"
    475     :type '(repeat (list symbol (choice symbol string)))
    476     :set #'modus-themes--set-option
    477     :initialize #'custom-initialize-default
    478     :link '(info-link "(modus-themes) Palette overrides"))
    479 
    480   (modus-themes-theme modus-operandi-deuteranopia
    481                       modus-operandi-deuteranopia-palette
    482                       modus-operandi-deuteranopia-palette-overrides)
    483 
    484   (provide-theme 'modus-operandi-deuteranopia))
    485 
    486 ;;; modus-operandi-deuteranopia-theme.el ends here