dotemacs

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

modus-vivendi-tritanopia-theme.el (15095B)


      1 ;;; modus-vivendi-tritanopia-theme.el --- Tritanopia-optimized theme with a black 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-vivendi-tritanopia
     47     "Tritanopia-optimized theme with a black background.
     48 This variant is optimized for users with blue-yellow color
     49 deficiency (tritanopia).  It conforms with the highest
     50 legibility standard for color contrast between background and
     51 foreground in any given piece of text, which corresponds to a
     52 minimum contrast in relative luminance of 7:1 (WCAG AAA
     53 standard)."
     54     :background-mode 'dark
     55     :kind 'color-scheme
     56     :family 'modus)
     57 
     58   (defconst modus-vivendi-tritanopia-palette
     59     '(
     60 ;;; Basic values
     61 
     62       (bg-main          "#000000")
     63       (bg-dim           "#1e1e1e")
     64       (fg-main          "#ffffff")
     65       (fg-dim           "#989898")
     66       (fg-alt           "#c6daff")
     67       (bg-active        "#535353")
     68       (bg-inactive      "#303030")
     69       (border           "#646464")
     70 
     71 ;;; Common accent foregrounds
     72 
     73       (red             "#ff5f59")
     74       (red-warmer      "#ff6740")
     75       (red-cooler      "#ff6f9f")
     76       (red-faint       "#ff9070")
     77       (red-intense     "#ff5f5f")
     78       (green           "#44bc44")
     79       (green-warmer    "#70b900")
     80       (green-cooler    "#00c06f")
     81       (green-faint     "#88ca9f")
     82       (green-intense   "#44df44")
     83       (yellow          "#cabf00")
     84       (yellow-warmer   "#ffa00f")
     85       (yellow-cooler   "#d8af7a")
     86       (yellow-faint    "#d2b580")
     87       (yellow-intense  "#efef00")
     88       (blue            "#2fafff")
     89       (blue-warmer     "#79a8ff")
     90       (blue-cooler     "#00bcff")
     91       (blue-faint      "#82b0ec")
     92       (blue-intense    "#338fff")
     93       (magenta         "#feacd0")
     94       (magenta-warmer  "#f78fe7")
     95       (magenta-cooler  "#b6a0ff")
     96       (magenta-faint   "#caa6df")
     97       (magenta-intense "#ef7fff")
     98       (cyan            "#00d3d0")
     99       (cyan-warmer     "#4ae2ff")
    100       (cyan-cooler     "#6ae4b9")
    101       (cyan-faint      "#7fdbdf")
    102       (cyan-intense    "#00eff0")
    103 
    104 ;;; Uncommon accent foregrounds
    105 
    106       (rust       "#db7b5f")
    107       (gold       "#c0965b")
    108       (olive      "#9cbd6f")
    109       (slate      "#76afbf")
    110       (indigo     "#9099d9")
    111       (maroon     "#cf7fa7")
    112       (pink       "#d09dc0")
    113 
    114 ;;; Common accent backgrounds
    115 
    116       (bg-red-intense     "#9d1f1f")
    117       (bg-green-intense   "#2f822f")
    118       (bg-yellow-intense  "#7a6100")
    119       (bg-blue-intense    "#1640b0")
    120       (bg-magenta-intense "#7030af")
    121       (bg-cyan-intense    "#2266ae")
    122 
    123       (bg-red-subtle      "#620f2a")
    124       (bg-green-subtle    "#00422a")
    125       (bg-yellow-subtle   "#4a4000")
    126       (bg-blue-subtle     "#242679")
    127       (bg-magenta-subtle  "#552f5f")
    128       (bg-cyan-subtle     "#004065")
    129 
    130       (bg-red-nuanced     "#3a0c14")
    131       (bg-green-nuanced   "#092f1f")
    132       (bg-yellow-nuanced  "#381d0f")
    133       (bg-blue-nuanced    "#12154a")
    134       (bg-magenta-nuanced "#2f0c3f")
    135       (bg-cyan-nuanced    "#042837")
    136 
    137 ;;; Uncommon accent backgrounds
    138 
    139       (bg-ochre    "#442c2f")
    140       (bg-lavender "#38325c")
    141       (bg-sage     "#0f3d30")
    142 
    143 ;;; Graphs
    144 
    145       (bg-graph-red-0     "#b52c2c")
    146       (bg-graph-red-1     "#702020")
    147       (bg-graph-green-0   "#afd1c0")
    148       (bg-graph-green-1   "#607a8f")
    149       (bg-graph-yellow-0  "#facfd6")
    150       (bg-graph-yellow-1  "#b57b85")
    151       (bg-graph-blue-0    "#4f9fdf")
    152       (bg-graph-blue-1    "#004559")
    153       (bg-graph-magenta-0 "#b6427f")
    154       (bg-graph-magenta-1 "#7f506f")
    155       (bg-graph-cyan-0    "#57dfea")
    156       (bg-graph-cyan-1    "#00808f")
    157 
    158 ;;; Special purpose
    159 
    160       (bg-completion       "#004253")
    161       (bg-hover            "#8e3e3b")
    162       (bg-hover-secondary  "#00405f")
    163       (bg-hl-line          "#2f3849")
    164       (bg-region           "#5a5a5a")
    165       (fg-region           "#ffffff")
    166 
    167       (bg-char-0 "#922a00")
    168       (bg-char-1 "#00709f")
    169       (bg-char-2 "#5f3faf")
    170 
    171       (bg-mode-line-active        "#003c52")
    172       (fg-mode-line-active        "#f0f0f0")
    173       (border-mode-line-active    "#5f8fb4")
    174       (bg-mode-line-inactive      "#2d2d2d")
    175       (fg-mode-line-inactive      "#969696")
    176       (border-mode-line-inactive  "#606060")
    177 
    178       (modeline-err     "#ff7fbf")
    179       (modeline-warning "#df9f93")
    180       (modeline-info    "#4fcfef")
    181 
    182       (bg-tab-bar      "#313131")
    183       (bg-tab-current  "#000000")
    184       (bg-tab-other    "#545454")
    185 
    186 ;;; Diffs
    187 
    188       (bg-added           "#004254")
    189       (bg-added-faint     "#003042")
    190       (bg-added-refine    "#004f7f")
    191       (bg-added-fringe    "#008fcf")
    192       (fg-added           "#9fdfdf")
    193       (fg-added-intense   "#50c0ef")
    194 
    195       (bg-changed         "#2f123f")
    196       (bg-changed-faint   "#1f022f")
    197       (bg-changed-refine  "#3f325f")
    198       (bg-changed-fringe  "#7f55a0")
    199       (fg-changed         "#e3cfff")
    200       (fg-changed-intense "#cf9fe2")
    201 
    202       (bg-removed         "#4f1119")
    203       (bg-removed-faint   "#380a0f")
    204       (bg-removed-refine  "#781a1f")
    205       (bg-removed-fringe  "#b81a1f")
    206       (fg-removed         "#ffbfbf")
    207       (fg-removed-intense "#ff9095")
    208 
    209       (bg-diff-context    "#1a1a1a")
    210 
    211 ;;; Paren match
    212 
    213       (bg-paren-match        "#2f7f9f")
    214       (fg-paren-match        fg-main)
    215       (bg-paren-expression   "#453040")
    216       (underline-paren-match unspecified)
    217 
    218 ;;; Mappings
    219 
    220 ;;;; General mappings
    221 
    222       (fringe bg-dim)
    223       (cursor red-intense)
    224 
    225       (keybind red)
    226       (name red-cooler)
    227       (identifier red-faint)
    228 
    229       (err red-warmer)
    230       (warning magenta)
    231       (info cyan)
    232 
    233       (underline-err red-intense)
    234       (underline-warning magenta-intense)
    235       (underline-note cyan-intense)
    236 
    237       (bg-prominent-err bg-red-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       (bg-active-argument bg-red-nuanced)
    245       (fg-active-argument red-warmer)
    246       (bg-active-value bg-cyan-nuanced)
    247       (fg-active-value cyan)
    248 
    249 ;;;; Code mappings
    250 
    251       (builtin magenta)
    252       (comment red-faint)
    253       (constant green-faint)
    254       (docstring fg-alt)
    255       (docmarkup magenta-faint)
    256       (fnname cyan-warmer)
    257       (keyword red-cooler)
    258       (preprocessor red-warmer)
    259       (string cyan)
    260       (type blue-warmer)
    261       (variable cyan-cooler)
    262       (rx-construct red)
    263       (rx-backslash magenta)
    264 
    265 ;;;; Accent mappings
    266 
    267       (accent-0 cyan)
    268       (accent-1 red-warmer)
    269       (accent-2 cyan-cooler)
    270       (accent-3 magenta)
    271 
    272 ;;;; Button mappings
    273 
    274       (fg-button-active fg-main)
    275       (fg-button-inactive fg-dim)
    276       (bg-button-active bg-active)
    277       (bg-button-inactive bg-dim)
    278 
    279 ;;;; Completion mappings
    280 
    281       (fg-completion-match-0 cyan)
    282       (fg-completion-match-1 red-warmer)
    283       (fg-completion-match-2 magenta)
    284       (fg-completion-match-3 cyan-cooler)
    285       (bg-completion-match-0 unspecified)
    286       (bg-completion-match-1 unspecified)
    287       (bg-completion-match-2 unspecified)
    288       (bg-completion-match-3 unspecified)
    289 
    290 ;;;; Date mappings
    291 
    292       (date-common cyan-cooler)
    293       (date-deadline red)
    294       (date-event fg-alt)
    295       (date-holiday red-intense)
    296       (date-holiday-other cyan-warmer)
    297       (date-now fg-main)
    298       (date-range fg-alt)
    299       (date-scheduled magenta)
    300       (date-weekday cyan)
    301       (date-weekend red-faint)
    302 
    303 ;;;; Line number mappings
    304 
    305       (fg-line-number-inactive fg-dim)
    306       (fg-line-number-active fg-main)
    307       (bg-line-number-inactive bg-dim)
    308       (bg-line-number-active bg-active)
    309 
    310 ;;;; Link mappings
    311 
    312       (fg-link cyan)
    313       (bg-link unspecified)
    314       (underline-link cyan)
    315 
    316       (fg-link-symbolic cyan-cooler)
    317       (bg-link-symbolic unspecified)
    318       (underline-link-symbolic cyan-cooler)
    319 
    320       (fg-link-visited magenta)
    321       (bg-link-visited unspecified)
    322       (underline-link-visited magenta)
    323 
    324 ;;;; Mail mappings
    325 
    326       (mail-cite-0 cyan-faint)
    327       (mail-cite-1 red-faint)
    328       (mail-cite-2 magenta-warmer)
    329       (mail-cite-3 cyan-warmer)
    330       (mail-part cyan-cooler)
    331       (mail-recipient cyan)
    332       (mail-subject red-cooler)
    333       (mail-other cyan)
    334 
    335 ;;;; Mark mappings
    336 
    337       (bg-mark-delete bg-red-subtle)
    338       (fg-mark-delete red)
    339       (bg-mark-select bg-cyan-subtle)
    340       (fg-mark-select cyan)
    341       (bg-mark-other bg-magenta-subtle)
    342       (fg-mark-other magenta-warmer)
    343 
    344 ;;;; Prompt mappings
    345 
    346       (fg-prompt cyan-cooler)
    347       (bg-prompt unspecified)
    348 
    349 ;;;; Prose mappings
    350 
    351       (bg-prose-block-delimiter bg-dim)
    352       (fg-prose-block-delimiter fg-dim)
    353       (bg-prose-block-contents bg-dim)
    354 
    355       (bg-prose-code unspecified)
    356       (fg-prose-code cyan)
    357 
    358       (bg-prose-macro unspecified)
    359       (fg-prose-macro red-warmer)
    360 
    361       (bg-prose-verbatim unspecified)
    362       (fg-prose-verbatim magenta-warmer)
    363 
    364       (prose-done cyan)
    365       (prose-todo red)
    366 
    367       (prose-metadata fg-dim)
    368       (prose-metadata-value fg-alt)
    369 
    370       (prose-table fg-alt)
    371       (prose-table-formula red-cooler)
    372 
    373       (prose-tag magenta-faint)
    374 
    375 ;;;; Rainbow mappings
    376 
    377       (rainbow-0 cyan)
    378       (rainbow-1 red)
    379       (rainbow-2 cyan-warmer)
    380       (rainbow-3 red-cooler)
    381       (rainbow-4 cyan-cooler)
    382       (rainbow-5 magenta)
    383       (rainbow-6 cyan-faint)
    384       (rainbow-7 magenta-faint)
    385       (rainbow-8 red-faint)
    386 
    387 ;;;; Search mappings
    388 
    389       (bg-search-current bg-red-intense)
    390       (bg-search-lazy bg-cyan-intense)
    391       (bg-search-replace bg-magenta-intense)
    392 
    393       (bg-search-rx-group-0 bg-blue-intense)
    394       (bg-search-rx-group-1 bg-magenta-intense)
    395       (bg-search-rx-group-2 bg-cyan-subtle)
    396       (bg-search-rx-group-3 bg-red-subtle)
    397 
    398 ;;;; Space mappings
    399 
    400       (bg-space unspecified)
    401       (fg-space border)
    402       (bg-space-err bg-red-intense)
    403 
    404 ;;;; Terminal mappings
    405 
    406       (bg-term-black           "#000000")
    407       (fg-term-black           "#000000")
    408       (bg-term-black-bright    "#595959")
    409       (fg-term-black-bright    "#595959")
    410 
    411       (bg-term-red             red)
    412       (fg-term-red             red)
    413       (bg-term-red-bright      red-warmer)
    414       (fg-term-red-bright      red-warmer)
    415 
    416       (bg-term-green           green)
    417       (fg-term-green           green)
    418       (bg-term-green-bright    green-cooler)
    419       (fg-term-green-bright    green-cooler)
    420 
    421       (bg-term-yellow          yellow)
    422       (fg-term-yellow          yellow)
    423       (bg-term-yellow-bright   yellow-warmer)
    424       (fg-term-yellow-bright   yellow-warmer)
    425 
    426       (bg-term-blue            blue)
    427       (fg-term-blue            blue)
    428       (bg-term-blue-bright     blue-warmer)
    429       (fg-term-blue-bright     blue-warmer)
    430 
    431       (bg-term-magenta         magenta)
    432       (fg-term-magenta         magenta)
    433       (bg-term-magenta-bright  magenta-cooler)
    434       (fg-term-magenta-bright  magenta-cooler)
    435 
    436       (bg-term-cyan            cyan)
    437       (fg-term-cyan            cyan)
    438       (bg-term-cyan-bright     cyan-cooler)
    439       (fg-term-cyan-bright     cyan-cooler)
    440 
    441       (bg-term-white           "#a6a6a6")
    442       (fg-term-white           "#a6a6a6")
    443       (bg-term-white-bright    "#ffffff")
    444       (fg-term-white-bright    "#ffffff")
    445 
    446 ;;;; Heading mappings
    447 
    448       (fg-heading-0 cyan-cooler)
    449       (fg-heading-1 fg-main)
    450       (fg-heading-2 red-faint)
    451       (fg-heading-3 cyan-faint)
    452       (fg-heading-4 magenta)
    453       (fg-heading-5 green-faint)
    454       (fg-heading-6 magenta-faint)
    455       (fg-heading-7 cyan-faint)
    456       (fg-heading-8 fg-dim)
    457 
    458       (bg-heading-0 unspecified)
    459       (bg-heading-1 unspecified)
    460       (bg-heading-2 unspecified)
    461       (bg-heading-3 unspecified)
    462       (bg-heading-4 unspecified)
    463       (bg-heading-5 unspecified)
    464       (bg-heading-6 unspecified)
    465       (bg-heading-7 unspecified)
    466       (bg-heading-8 unspecified)
    467 
    468       (overline-heading-0 unspecified)
    469       (overline-heading-1 unspecified)
    470       (overline-heading-2 unspecified)
    471       (overline-heading-3 unspecified)
    472       (overline-heading-4 unspecified)
    473       (overline-heading-5 unspecified)
    474       (overline-heading-6 unspecified)
    475       (overline-heading-7 unspecified)
    476       (overline-heading-8 unspecified))
    477     "The entire palette of the `modus-vivendi-tritanopia' theme.
    478 
    479 Named colors have the form (COLOR-NAME HEX-VALUE) with the former
    480 as a symbol and the latter as a string.
    481 
    482 Semantic color mappings have the form (MAPPING-NAME COLOR-NAME)
    483 with both as symbols.  The latter is a named color that already
    484 exists in the palette and is associated with a HEX-VALUE.")
    485 
    486   (defcustom modus-vivendi-tritanopia-palette-overrides nil
    487     "Overrides for `modus-vivendi-tritanopia-palette'.
    488 
    489 Mirror the elements of the aforementioned palette, overriding
    490 their value.
    491 
    492 For overrides that are shared across all of the Modus themes,
    493 refer to `modus-themes-common-palette-overrides'.
    494 
    495 Theme-specific overrides take precedence over shared overrides.
    496 The idea of common overrides is to change semantic color
    497 mappings, such as to make the cursor red.  Wherea theme-specific
    498 overrides can also be used to change the value of a named color,
    499 such as what hexadecimal RGB value the red-warmer symbol
    500 represents."
    501     :group 'modus-themes
    502     :package-version '(modus-themes . "4.0.0")
    503     :version "30.1"
    504     :type '(repeat (list symbol (choice symbol string)))
    505     :set #'modus-themes--set-option
    506     :initialize #'custom-initialize-default
    507     :link '(info-link "(modus-themes) Palette overrides"))
    508 
    509   (modus-themes-theme modus-vivendi-tritanopia
    510                       modus-vivendi-tritanopia-palette
    511                       modus-vivendi-tritanopia-palette-overrides)
    512 
    513   (provide-theme 'modus-vivendi-tritanopia))
    514 
    515 ;;; modus-vivendi-tritanopia-theme.el ends here