dotemacs

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

modus-themes.org (226182B)


      1 #+title: Modus themes for GNU Emacs
      2 #+author: Protesilaos Stavrou
      3 #+email: info@protesilaos.com
      4 #+language: en
      5 #+options: ':t toc:nil author:t email:t num:t
      6 #+startup: content
      7 #+macro: stable-version 4.3.0
      8 #+macro: release-date 2023-09-19
      9 #+macro: development-version 4.4.0-dev
     10 #+macro: file @@texinfo:@file{@@$1@@texinfo:}@@
     11 #+macro: space @@texinfo:@: @@
     12 #+macro: kbd @@texinfo:@kbd{@@$1@@texinfo:}@@
     13 #+texinfo_filename: modus-themes.info
     14 #+texinfo_dir_category: Emacs misc features
     15 #+texinfo_dir_title: Modus Themes: (modus-themes)
     16 #+texinfo_dir_desc: Elegant, highly legible and customizable themes
     17 #+texinfo_header: @set MAINTAINERSITE @uref{https://protesilaos.com,maintainer webpage}
     18 #+texinfo_header: @set MAINTAINER Protesilaos Stavrou
     19 #+texinfo_header: @set MAINTAINEREMAIL @email{info@protesilaos.com}
     20 #+texinfo_header: @set MAINTAINERCONTACT @uref{mailto:info@protesilaos.com,contact the maintainer}
     21 
     22 #+texinfo: @insertcopying
     23 
     24 This manual, written by Protesilaos Stavrou, describes the
     25 customization options for the Modus themes, and provides every other
     26 piece of information pertinent to them.
     27 
     28 The documentation furnished herein corresponds to stable version
     29 {{{stable-version}}}, released on {{{release-date}}}.  Any reference
     30 to a newer feature which does not yet form part of the latest tagged
     31 commit, is explicitly marked as such.
     32 
     33 Current development target is {{{development-version}}}.
     34 
     35 + Package name (GNU ELPA): ~modus-themes~
     36 + Official manual: <https://protesilaos.com/emacs/modus-themes>
     37 + Change log: <https://protesilaos.com/emacs/modus-themes-changelog>
     38 + Color palette: <https://protesilaos.com/emacs/modus-themes-colors>
     39 + Sample pictures: <https://protesilaos.com/emacs/modus-themes-pictures>
     40 + Git repo on SourceHut: <https://git.sr.ht/~protesilaos/modus-themes>
     41   - Mirrors:
     42     + GitHub: <https://github.com/protesilaos/modus-themes>
     43     + GitLab: <https://gitlab.com/protesilaos/modus-themes>
     44 + Mailing list: <https://lists.sr.ht/~protesilaos/modus-themes>
     45 + Backronym: My Old Display Unexpectedly Sharpened ... themes
     46 
     47 #+toc: headlines 8 insert TOC here, with eight headline levels
     48 
     49 * COPYING
     50 :properties:
     51 :copying: t
     52 :custom_id: h:b14c3fcb-13dd-4144-9d92-2c58b3ed16d3
     53 :end:
     54 
     55 Copyright (C) 2020-2023  Free Software Foundation, Inc.
     56 
     57 #+begin_quote
     58 Permission is granted to copy, distribute and/or modify this document
     59 under the terms of the GNU Free Documentation License, Version 1.3 or
     60 any later version published by the Free Software Foundation; with no
     61 Invariant Sections, with the Front-Cover Texts being “A GNU Manual,” and
     62 with the Back-Cover Texts as in (a) below.  A copy of the license is
     63 included in the section entitled “GNU Free Documentation License.”
     64 
     65 (a) The FSF’s Back-Cover Text is: “You have the freedom to copy and
     66 modify this GNU manual.”
     67 #+end_quote
     68 
     69 * Overview
     70 :properties:
     71 :custom_id: h:f0f3dbcb-602d-40cf-b918-8f929c441baf
     72 :end:
     73 
     74 The Modus themes are designed for accessible readability.  They
     75 conform with the highest standard for color contrast between
     76 combinations of background and foreground values.  For small sized
     77 text, this corresponds to the WCAG AAA standard, which specifies a
     78 minimum rate of distance in relative luminance of 7:1.
     79 
     80 The Modus themes consist of eight themes, divided into four subgroups.
     81 
     82 - Main themes :: ~modus-operandi~ is the project's main light theme,
     83   while ~modus-vivendi~ is its dark counterpart.  These two themes are
     84   part of the project since its inception.  They are designed to cover
     85   a broad range of needs and are, in the opinion of the author, the
     86   reference for what a highly legible "default" theme should look
     87   like.
     88 
     89 - Tinted themes :: ~modus-operandi-tinted~ and ~modus-vivendi-tinted~
     90   are variants of the two main themes.  They slightly tone down the
     91   intensity of the background and provide a bit more color variety.
     92   ~modus-operandi-tinted~ has a set of base tones that are shades of
     93   light ochre (earthly colors), while ~modus-vivendi-tinted~ gives a
     94   night sky impression.
     95 
     96 - Deuteranopia themes :: ~modus-operandi-deuteranopia~ and its
     97   companion ~modus-vivendi-deuteranopia~ are optimized for users with
     98   red-green color deficiency.  This means that they do not use red and
     99   green hues for color-coding purposes, such as for diff removed and
    100   added lines.  Instead, they implement colors that are discernible by
    101   users with deueteranopia or deuteranomaly (mostly yellow and blue
    102   hues).
    103 
    104 - Tritanopia themes :: ~modus-operandi-tritanopia~ and its counterpart
    105   ~modus-vivendi-tritanopia~ are optimized for users with blue-yellow
    106   color deficiency.  The idea is the same as with the deuteranopia
    107   variants: color coding relies only on hues that are accessible to
    108   people with tritanopia or tritanomaly, namely, shades of red and
    109   cyan.
    110 
    111 To ensure that users have a consistently accessible experience, the
    112 themes strive to achieve as close to full face coverage as possible,
    113 while still targeting a curated list of well-maintained packages
    114 ([[#h:a9c8f29d-7f72-4b54-b74b-ddefe15d6a19][Face coverage]]).
    115 
    116 The overarching objective of this project is to always offer
    117 accessible color combinations.  There shall never be a compromise on
    118 this principle.  If there arises an inescapable trade-off between
    119 usability and stylistic considerations, we will always opt for the
    120 former.
    121 
    122 Starting with version 0.12.0 and onwards, the themes are built into GNU
    123 Emacs.
    124 
    125 ** How do the themes look like
    126 :properties:
    127 :custom_id: h:69b92089-069c-4ba1-9d94-cc3415fc4f87
    128 :end:
    129 #+cindex: Screenshots
    130 
    131 Check the web page with [[https://protesilaos.com/emacs/modus-themes-pictures/][the screen shots]].  Note that the themes are
    132 highly customizable ([[#h:bf1c82f2-46c7-4eb2-ad00-dd11fdd8b53f][Customization options]]).
    133 
    134 ** Learn about the latest changes
    135 :properties:
    136 :custom_id: h:2cc37c36-6c1a-48b2-a010-1050b270ee18
    137 :end:
    138 #+cindex: Changelog
    139 
    140 Please refer to the [[https://protesilaos.com/emacs/modus-themes-changelog][web page with the change log]].  It is comprehensive
    141 and covers everything that goes into every tagged release of the themes.
    142 
    143 * Installation
    144 :properties:
    145 :custom_id: h:1af85373-7f81-4c35-af25-afcef490c111
    146 :end:
    147 
    148 The Modus themes are distributed with Emacs starting with version 28.1.
    149 On older versions of Emacs, they can be installed using Emacs' package
    150 manager or manually from their code repository.  There also exist
    151 packages for distributions of GNU/Linux.
    152 
    153 Emacs 28 ships with ~modus-themes~ version =1.6.0=.  Emacs 29 includes
    154 version =3.0.0=.  Emacs 30 provides a newer, refactored version that
    155 thoroughly refashions how the themes are implemented and customized.
    156 Such major versions are not backward-compatible due to the limited
    157 resources at the maintainer's disposal to support multiple versions of
    158 Emacs and of the themes across the years.
    159 
    160 ** Install manually from source
    161 :properties:
    162 :custom_id: h:da3414b7-1426-46b8-8e76-47b845b76fd0
    163 :end:
    164 
    165 In the following example, we are assuming that your Emacs files are
    166 stored in {{{file(~/.emacs.d)}}} and that you want to place the Modus
    167 themes in {{{file(~/.emacs.d/modus-themes)}}}.
    168 
    169 1. Get the source and store it in the desired path by running the
    170    following in the command line shell:
    171 
    172 : $ git clone https://gitlab.com/protesilaos/modus-themes.git ~/.emacs.d/modus-themes
    173 
    174 2. Add that path to your known Elisp libraries' list, by placing this
    175    snippet of Emacs Lisp in your init file (e.g. {{{file(init.el)}}}):
    176 
    177 #+begin_src emacs-lisp
    178 (add-to-list 'load-path "~/.emacs.d/modus-themes")
    179 #+end_src
    180 
    181 The themes are now ready to be used: [[#h:3f3c3728-1b34-437d-9d0c-b110f5b161a9][Enable and load]].
    182 
    183 ** Install from the archives
    184 :properties:
    185 :custom_id: h:c4b10085-149f-43e2-bd4d-347f33aee054
    186 :end:
    187 
    188 The ~modus-themes~ package is available from the GNU ELPA archive, which
    189 is configured by default.
    190 
    191 Prior to querying any package archive, make sure to update the index,
    192 with {{{kbd(M-x package-refresh-contents)}}}.  Then all you need to do
    193 is type {{{kbd(M-x package-install)}}} and specify the ~modus-themes~.
    194 
    195 Once installed, the themes are ready to be used: [[#h:3f3c3728-1b34-437d-9d0c-b110f5b161a9][Enable and load]].
    196 
    197 ** Install on GNU/Linux
    198 :properties:
    199 :custom_id: h:da640eb1-95dd-4e86-bb4e-1027b27885f0
    200 :end:
    201 
    202 The themes are also available from the archives of some distributions of
    203 GNU/Linux.  These should correspond to a tagged release rather than
    204 building directly from the latest Git commit.  It all depends on the
    205 distro's packaging policies.
    206 
    207 *** Debian 11 Bullseye
    208 :properties:
    209 :custom_id: h:7e570360-9ee6-4bc5-8c04-9dc11418a3e4
    210 :end:
    211 
    212 The themes are part of Debian 11 Bullseye.  Get them with:
    213 
    214 #+begin_src sh
    215 sudo apt install elpa-modus-themes
    216 #+end_src
    217 
    218 They are now ready to be used: [[#h:3f3c3728-1b34-437d-9d0c-b110f5b161a9][Enable and load]].
    219 
    220 NOTE that Debian's package is severely out-of-date as of this writing
    221 2022-07-24 09:57 +0300.
    222 
    223 *** GNU Guix
    224 :properties:
    225 :custom_id: h:a4ca52cd-869f-46a5-9e16-4d9665f5b88e
    226 :end:
    227 
    228 Users of Guix can get the themes with this command:
    229 
    230 #+begin_src sh
    231 guix package -i emacs-modus-themes
    232 #+end_src
    233 
    234 They are now ready to be used: [[#h:3f3c3728-1b34-437d-9d0c-b110f5b161a9][Enable and load]].
    235 
    236 ** Dealing with byte compilation errors
    237 :properties:
    238 :custom_id: h:e6268471-e847-4c9d-998f-49a83257b7f1
    239 :end:
    240 
    241 From time to time, we receive bug reports pertaining to errors with
    242 byte compilation.  These seldom have to do with faulty code in the
    243 themes: it might be a shortcoming of {{{file(package.el)}}}, some
    244 regression in the current development target of Emacs, a
    245 misconfiguration in an otherwise exotic setup, and the like.
    246 
    247 The common solution with a stable version of Emacs is to:
    248 
    249 1. Delete the ~modus-themes~ package.
    250 2. Close the current Emacs session.
    251 3. Install the ~modus-themes~ again.
    252 
    253 For those building Emacs directly from source, the solution may involve
    254 reverting to an earlier commit in emacs.git.
    255 
    256 At any rate, if you encounter such an issue please report it: we will
    257 either fix the bug on our end if it is truly ours, or help forward it to
    258 the relevant upstream maintainer.  Whatever you do, please understand
    259 that a build failure does not mean we are necessarily doing something
    260 wrong.
    261 
    262 [[#h:6536c8d5-3f98-43ab-a787-b94120e735e8][Issues you can help with]].
    263 
    264 * Enable and load
    265 :properties:
    266 :custom_id: h:3f3c3728-1b34-437d-9d0c-b110f5b161a9
    267 :end:
    268 #+findex: modus-themes-toggle
    269 #+findex: modus-themes-load-theme
    270 #+vindex: modus-themes-after-load-theme-hook
    271 #+cindex: Essential configuration
    272 
    273 NOTE that Emacs can load multiple themes, which typically produces
    274 undesirable results and undoes the work of the designer.  Use the
    275 ~disable-theme~ command if you are trying other themes beside the
    276 Modus collection ([[#h:adb0c49a-f1f9-4690-868b-013a080eed68][Option for disabling other themes while loading Modus]]).
    277 
    278 Users of the built-in themes cannot ~require~ the package as usual
    279 because there is no package to speak of.  Instead, things are simpler
    280 as built-in themes are considered safe.  All one needs is to load the
    281 theme of their preference by adding either form to their init file:
    282 
    283 #+begin_src emacs-lisp
    284 (load-theme 'modus-operandi)            ; Light theme
    285 (load-theme 'modus-vivendi)             ; Dark theme
    286 #+end_src
    287 
    288 Remember that the Modus themes are six themes ([[#h:f0f3dbcb-602d-40cf-b918-8f929c441baf][Overview]]).  Adapt the
    289 above snippet accordingly.
    290 
    291 Users of packaged variants of the themes must add a few more lines to
    292 ensure that everything works as intended.  First, one has to require the
    293 main library before loading one of the themes:
    294 
    295 #+begin_src emacs-lisp
    296 (require 'modus-themes)
    297 #+end_src
    298 
    299 One can activate a theme with something like the following expression,
    300 replacing ~modus-operandi~ with their preferred Modus theme:
    301 
    302 #+begin_src emacs-lisp
    303 (load-theme 'modus-operandi :no-confirm)
    304 #+end_src
    305 
    306 Changes to the available customization options must always be evaluated
    307 before loading a theme ([[#h:bf1c82f2-46c7-4eb2-ad00-dd11fdd8b53f][Customization Options]]).  Reload a theme for
    308 new changes to take effect.
    309 
    310 This is how a basic setup could look like ([[#h:b66b128d-54a4-4265-b59f-4d1ea2feb073][The require-theme for built-in Emacs themes]]):
    311 
    312 #+begin_src emacs-lisp
    313 ;;; For the built-in themes which cannot use `require'.
    314 (require-theme 'modus-themes)
    315 
    316 ;; Add all your customizations prior to loading the themes.
    317 (setq modus-themes-italic-constructs t
    318       modus-themes-bold-constructs nil)
    319 
    320 ;; Load the theme of your choice.
    321 (load-theme 'modus-operandi)
    322 
    323 ;; Optionally define a key to switch between Modus themes.  Also check
    324 ;; the user option `modus-themes-to-toggle'.
    325 (define-key global-map (kbd "<f5>") #'modus-themes-toggle)
    326 
    327 
    328 
    329 ;;; For packaged versions which must use `require'.
    330 
    331 (require 'modus-themes)
    332 
    333 ;; Add all your customizations prior to loading the themes
    334 (setq modus-themes-italic-constructs t
    335       modus-themes-bold-constructs nil)
    336 
    337 ;; Load the theme of your choice.
    338 (load-theme 'modus-operandi :no-confirm)
    339 
    340 (define-key global-map (kbd "<f5>") #'modus-themes-toggle)
    341 #+end_src
    342 
    343 [[#h:e979734c-a9e1-4373-9365-0f2cd36107b8][Sample configuration with and without use-package]].
    344 
    345 ** The ~require-theme~ for built-in Emacs themes
    346 :PROPERTIES:
    347 :CUSTOM_ID: h:b66b128d-54a4-4265-b59f-4d1ea2feb073
    348 :END:
    349 
    350 The version of the Modus themes that is included in Emacs CANNOT use
    351 the standard ~require~.  This is because the built-in themes are not
    352 included in the ~load-path~ (not my decision).  The ~require-theme~
    353 function must be used in this case as a replacement.  For example:
    354 
    355 #+begin_src emacs-lisp
    356 (require-theme 'modus-themes)
    357 
    358 ;; All customizations here
    359 (setq modus-themes-bold-constructs t
    360       modus-themes-italic-constructs t)
    361 
    362 ;; Maybe define some palette overrides, such as by using our presets
    363 (setq modus-themes-common-palette-overrides
    364       modus-themes-preset-overrides-intense)
    365 
    366 ;; Load the theme of choice (built-in themes are always "safe" so they
    367 ;; do not need the `no-require' argument of `load-theme').
    368 (load-theme 'modus-operandi)
    369 
    370 (define-key global-map (kbd "<f5>") #'modus-themes-toggle)
    371 #+end_src
    372 
    373 ** Sample configuration with and without use-package
    374 :properties:
    375 :custom_id: h:e979734c-a9e1-4373-9365-0f2cd36107b8
    376 :end:
    377 #+cindex: use-package configuration
    378 #+cindex: sample configuration
    379 
    380 What follows is a variant of what we demonstrate in the previous
    381 section ([[#h:3f3c3728-1b34-437d-9d0c-b110f5b161a9][Enable and load]]).
    382 
    383 It is common for Emacs users to rely on ~use-package~ for declaring
    384 package configurations in their setup.  We use this as an example:
    385 
    386 #+begin_src emacs-lisp
    387 ;;; For the built-in themes which cannot use `require'.
    388 (use-package emacs
    389   :config
    390   (require-theme 'modus-themes) ; `require-theme' is ONLY for the built-in Modus themes
    391 
    392   ;; Add all your customizations prior to loading the themes
    393   (setq modus-themes-italic-constructs t
    394         modus-themes-bold-constructs nil)
    395 
    396   ;; Maybe define some palette overrides, such as by using our presets
    397   (setq modus-themes-common-palette-overrides
    398         modus-themes-preset-overrides-intense)
    399 
    400   ;; Load the theme of your choice.
    401   (load-theme 'modus-operandi)
    402 
    403   (define-key global-map (kbd "<f5>") #'modus-themes-toggle))
    404 
    405 
    406 
    407 ;;; For packaged versions which must use `require'.
    408 (use-package modus-themes
    409   :ensure t
    410   :config
    411   ;; Add all your customizations prior to loading the themes
    412   (setq modus-themes-italic-constructs t
    413         modus-themes-bold-constructs nil)
    414 
    415   ;; Maybe define some palette overrides, such as by using our presets
    416   (setq modus-themes-common-palette-overrides
    417         modus-themes-preset-overrides-intense)
    418 
    419   ;; Load the theme of your choice.
    420   (load-theme 'modus-operandi)
    421 
    422   (define-key global-map (kbd "<f5>") #'modus-themes-toggle))
    423 #+end_src
    424 
    425 The same without ~use-package~:
    426 
    427 #+begin_src emacs-lisp
    428 (require 'modus-themes) ; OR for the built-in themes: (require-theme 'modus-themes)
    429 
    430 ;; Add all your customizations prior to loading the themes
    431 (setq modus-themes-italic-constructs t
    432       modus-themes-bold-constructs nil)
    433 
    434 ;; Maybe define some palette overrides, such as by using our presets
    435 (setq modus-themes-common-palette-overrides
    436       modus-themes-preset-overrides-intense)
    437 
    438 ;; Load the theme of your choice:
    439 (load-theme 'modus-operandi :no-confirm)
    440 
    441 (define-key global-map (kbd "<f5>") #'modus-themes-toggle)
    442 #+end_src
    443 
    444 [[#h:e68560b3-7fb0-42bc-a151-e015948f8a35][Differences between loading and enabling]].
    445 
    446 Note: make sure not to customize the variable ~custom-theme-load-path~
    447 or ~custom-theme-directory~ after the themes' package declaration.  That
    448 will lead to failures in loading the files.  If either or both of those
    449 variables need to be changed, their values should be defined before the
    450 package declaration of the themes.
    451 
    452 [[#h:aabcada6-810d-4eee-b34a-d2a9c301824d][Make the themes look like what the maintainer uses]]
    453 
    454 ** Differences between loading and enabling
    455 :properties:
    456 :custom_id: h:e68560b3-7fb0-42bc-a151-e015948f8a35
    457 :end:
    458 #+cindex: load-theme VS enable-theme
    459 
    460 The reason we recommend ~load-theme~ instead of the other option of
    461 ~enable-theme~ is that the former does a kind of "reset" on the face
    462 specs.  It quite literally loads (or reloads) the theme.  Whereas the
    463 ~enable-theme~ function simply puts an already loaded theme to the top
    464 of the list of enabled items, re-using whatever state was last loaded.
    465 
    466 As such, ~load-theme~ reads all customizations that may happen during
    467 any given Emacs session: even after the initial setup of a theme.
    468 Examples are calls to ~custom-set-faces~, as well as new values assigned
    469 to the options the Modus themes provide ([[#h:bf1c82f2-46c7-4eb2-ad00-dd11fdd8b53f][Customization Options]]).
    470 
    471 Our tests show that ~enable-theme~ does not read such variables anew, so
    472 it might appear to the unsuspecting user that the themes are somehow
    473 broken whenever they try to assign a new value to a customization option
    474 or some face.
    475 
    476 This "reset" that ~load-theme~ brings about does, however, come at the
    477 cost of being somewhat slower than ~enable-theme~.  Users who have a
    478 stable setup and who seldom update their variables during a given Emacs
    479 session, are better off using something like this:
    480 
    481 #+begin_src emacs-lisp
    482 (require 'modus-themes)
    483 
    484 ;; Activate your desired themes here
    485 (load-theme 'modus-operandi t t)
    486 (load-theme 'modus-vivendi t t)
    487 
    488 ;; Enable the preferred one
    489 (enable-theme 'modus-operandi)
    490 #+end_src
    491 
    492 [[#h:b40aca50-a3b2-4c43-be58-2c26fcd14237][Toggle themes without reloading them]].
    493 
    494 [[#h:e979734c-a9e1-4373-9365-0f2cd36107b8][Sample configuration with and without use-package]].
    495 
    496 With the above granted, other sections of the manual discuss how to
    497 configure custom faces, where ~load-theme~ is expected, though
    498 ~enable-theme~ could still apply in stable setups:
    499 
    500 [[#h:51ba3547-b8c8-40d6-ba5a-4586477fd4ae][Use theme colors in code with modus-themes-with-colors]].
    501 
    502 * Customization options
    503 :properties:
    504 :custom_id: h:bf1c82f2-46c7-4eb2-ad00-dd11fdd8b53f
    505 :end:
    506 
    507 The Modus themes are highly configurable, though they should work well
    508 without any further tweaks.  We provide a variety of user options.
    509 The following code block provides an overview.  In addition to those
    510 variables, the themes support a comprehensive system of overrides: it
    511 can be used to make thoroughgoing changes to the looks of the themes
    512 ([[#h:34c7a691-19bb-4037-8d2f-67a07edab150][Option for palette overrides]]).  We document everything at length in
    513 the pages of this manual and also provide ready-to-use code samples.
    514 
    515 Remember that all customization options must be evaluated before loading
    516 a theme ([[#h:3f3c3728-1b34-437d-9d0c-b110f5b161a9][Enable and load]]).  If the theme is already active, it must be
    517 reloaded for changes to take effect.
    518 
    519 #+begin_src emacs-lisp
    520 ;; In all of the following, WEIGHT is a symbol such as `semibold',
    521 ;; `light', `bold', or anything mentioned in `modus-themes-weights'.
    522 (setq modus-themes-italic-constructs t
    523       modus-themes-bold-constructs nil
    524       modus-themes-mixed-fonts t
    525       modus-themes-variable-pitch-ui nil
    526       modus-themes-custom-auto-reload t
    527       modus-themes-disable-other-themes t
    528 
    529       ;; Options for `modus-themes-prompts' are either nil (the
    530       ;; default), or a list of properties that may include any of those
    531       ;; symbols: `italic', `WEIGHT'
    532       modus-themes-prompts '(italic bold)
    533 
    534       ;; The `modus-themes-completions' is an alist that reads two
    535       ;; keys: `matches', `selection'.  Each accepts a nil value (or
    536       ;; empty list) or a list of properties that can include any of
    537       ;; the following (for WEIGHT read further below):
    538       ;;
    539       ;; `matches'   :: `underline', `italic', `WEIGHT'
    540       ;; `selection' :: `underline', `italic', `WEIGHT'
    541       modus-themes-completions
    542       '((matches . (extrabold))
    543         (selection . (semibold italic text-also)))
    544 
    545       modus-themes-org-blocks 'gray-background ; {nil,'gray-background,'tinted-background}
    546 
    547       ;; The `modus-themes-headings' is an alist: read the manual's
    548       ;; node about it or its doc string.  Basically, it supports
    549       ;; per-level configurations for the optional use of
    550       ;; `variable-pitch' typography, a height value as a multiple of
    551       ;; the base font size (e.g. 1.5), and a `WEIGHT'.
    552       modus-themes-headings
    553       '((1 . (variable-pitch 1.5))
    554         (2 . (1.3))
    555         (agenda-date . (1.3))
    556         (agenda-structure . (variable-pitch light 1.8))
    557         (t . (1.1))))
    558 
    559 ;; Remember that more (MUCH MORE) can be done with overrides, which we
    560 ;; document extensively in this manual.
    561 #+end_src
    562 
    563 ** Option for reloading the theme on custom change
    564 :properties:
    565 :alt_title: Custom reload theme
    566 :description: Toggle auto-reload of the theme when setting custom variables
    567 :custom_id: h:9001527a-4e2c-43e0-98e8-3ef72d770639
    568 :end:
    569 #+vindex: modus-themes-custom-auto-reload
    570 
    571 Brief: Toggle reloading of the active theme when an option is changed
    572 through the Custom UI.
    573 
    574 Symbol: ~modus-themes-custom-auto-reload~ (=boolean= type)
    575 
    576 Possible values:
    577 
    578 1. ~nil~
    579 2. ~t~ (default)
    580 
    581 All theme user options take effect when a theme is loaded.  Any
    582 subsequent changes require the theme to be reloaded.
    583 
    584 When this variable has a non-~nil~ value, any change made via the Custom
    585 UI or related functions such as ~customize-set-variable~ and ~setopt~
    586 (Emacs 29), will trigger a reload automatically.
    587 
    588 With a ~nil~ value, changes to user options have no further consequences:
    589 the user must manually reload the theme ([[#h:3f3c3728-1b34-437d-9d0c-b110f5b161a9][Enable and load]]).
    590 
    591 ** Option for disabling other themes while loading Modus
    592 :properties:
    593 :alt_title: Disable other themes
    594 :description: Determine whether loading a Modus themes disables all others
    595 :custom_id: h:adb0c49a-f1f9-4690-868b-013a080eed68
    596 :end:
    597 #+vindex: modus-themes-disable-other-themes
    598 
    599 Brief: Disable all other themes when loading a Modus theme.
    600 
    601 Symbol: ~modus-themes-disable-other-themes~ (=boolean= type)
    602 
    603 Possible values:
    604 
    605 1. ~nil~
    606 2. ~t~ (default)
    607 
    608 When the value is non-~nil~, the commands ~modus-themes-toggle~ and
    609 ~modus-themes-select~, as well as the ~modus-themes-load-theme~
    610 function, will disable all other themes while loading the specified
    611 Modus theme.  This is done to ensure that Emacs does not blend two or
    612 more themes: such blends lead to awkward results that undermine the
    613 work of the designer.
    614 
    615 When the value is ~nil~, the aforementioned commands and function will
    616 only disable other themes within the Modus collection.
    617 
    618 This option is provided because Emacs themes are not necessarily
    619 limited to colors/faces: they can consist of an arbitrary set of
    620 customizations.  Users who use such customization bundles must set
    621 this variable to a ~nil~ value.
    622 
    623 ** Option for more bold constructs
    624 :properties:
    625 :alt_title: Bold constructs
    626 :description: Toggle bold constructs in code
    627 :custom_id: h:b25714f6-0fbe-41f6-89b5-6912d304091e
    628 :end:
    629 #+vindex: modus-themes-bold-constructs
    630 
    631 Brief: Use bold for code syntax highlighting and related.
    632 
    633 Symbol: ~modus-themes-bold-constructs~ (=boolean= type)
    634 
    635 Possible values:
    636 
    637 1. ~nil~ (default)
    638 2. ~t~
    639 
    640 The default is to use a bold typographic weight only when it is
    641 required.
    642 
    643 With a non-~nil~ value (~t~) display several syntactic constructs in
    644 bold weight.  This concerns keywords and other important aspects of
    645 code syntax.  It also affects certain mode line indicators and command
    646 prompts.
    647 
    648 Advanced users may also want to configure the exact attributes of the
    649 ~bold~ face.
    650 
    651 [[#h:2793a224-2109-4f61-a106-721c57c01375][Configure bold and italic faces]].
    652 
    653 ** Option for more italic constructs
    654 :properties:
    655 :alt_title: Italic constructs
    656 :description: Toggle italic font constructs in code
    657 :custom_id: h:977c900d-0d6d-4dbb-82d9-c2aae69543d6
    658 :end:
    659 #+vindex: modus-themes-italic-constructs
    660 
    661 Brief: Use italics for code syntax highlighting and related.
    662 
    663 Symbol: ~modus-themes-italic-constructs~ (=boolean= type)
    664 
    665 Possible values:
    666 
    667 1. ~nil~ (default)
    668 2. ~t~
    669 
    670 The default is to not use slanted text forms (italics) unless it is
    671 absolutely necessary.
    672 
    673 With a non-~nil~ value (~t~) choose to render more faces in italics.  This
    674 typically affects documentation strings and code comments.
    675 
    676 Advanced users may also want to configure the exact attributes of the
    677 ~italic~ face.
    678 
    679 [[#h:2793a224-2109-4f61-a106-721c57c01375][Configure bold and italic faces]].
    680 
    681 ** Option for font mixing
    682 :properties:
    683 :alt_title: Mixed fonts
    684 :description: Toggle mixing of font families
    685 :custom_id: h:115e6c23-ee35-4a16-8cef-e2fcbb08e28b
    686 :end:
    687 #+vindex: modus-themes-mixed-fonts
    688 
    689 Brief: Toggle the use of monospaced fonts for spacing-sensitive
    690 constructs (affects font families).
    691 
    692 Symbol: ~modus-themes-mixed-fonts~ (=boolean= type)
    693 
    694 Possible values:
    695 
    696 1. ~nil~ (default)
    697 2. ~t~
    698 
    699 When set to non-~nil~ (~t~), configure some spacing-sensitive faces like Org
    700 tables and code blocks to always inherit from the ~fixed-pitch~ face.
    701 This is to ensure that certain constructs like code blocks and tables
    702 remain monospaced even when users opt for a mode that remaps typeface
    703 families, such as the built-in {{{kbd(M-x variable-pitch-mode)}}}.  Otherwise
    704 the layout can appear broken, due to how spacing is done.
    705 
    706 For a consistent experience, user may need to specify the font family of
    707 the ~fixed-pitch~ face.
    708 
    709 [[#h:defcf4fc-8fa8-4c29-b12e-7119582cc929][Font configurations for Org and others]].
    710 
    711 ** Option for command prompt styles
    712 :properties:
    713 :alt_title: Command prompts
    714 :description: Control the style of command prompts
    715 :custom_id: h:db5a9a7c-2928-4a28-b0f0-6f2b9bd52ba1
    716 :end:
    717 #+vindex: modus-themes-prompts
    718 
    719 Brief: Control the style of command prompts (e.g. minibuffer, shell, IRC
    720 clients).
    721 
    722 Symbol: ~modus-themes-prompts~ (=choice= type, list of properties)
    723 
    724 Possible values are expressed as a list of properties (default is ~nil~ or
    725 an empty list).  The list can include any of the following symbols:
    726 
    727 + ~italic~
    728 + ~italic~
    729 + A font weight, which must be supported by the underlying typeface:
    730   - ~thin~
    731   - ~ultralight~
    732   - ~extralight~
    733   - ~light~
    734   - ~semilight~
    735   - ~regular~
    736   - ~medium~
    737   - ~semibold~
    738   - ~bold~
    739   - ~heavy~
    740   - ~extrabold~
    741   - ~ultrabold~
    742 
    743 The default (a ~nil~ value or an empty list) means to only use a subtle
    744 colored foreground color.
    745 
    746 The ~italic~ property adds a slant to the font's forms (italic or
    747 oblique forms, depending on the typeface).
    748 
    749 The symbol of a font weight attribute such as ~light~, ~semibold~, et
    750 cetera, adds the given weight to links.  Valid symbols are defined in
    751 the variable ~modus-themes-weights~.  The absence of a weight means
    752 that the one of the underlying text will be used.
    753 
    754 Combinations of any of those properties are expressed as a list, like in
    755 these examples:
    756 
    757 #+begin_src emacs-lisp
    758 (bold italic)
    759 (italic semibold)
    760 #+end_src
    761 
    762 The order in which the properties are set is not significant.
    763 
    764 In user configuration files the form may look like this:
    765 
    766 #+begin_src emacs-lisp
    767 (setq modus-themes-prompts '(extrabold italic))
    768 #+end_src
    769 
    770 [[#h:bd75b43a-0bf1-45e7-b8b4-20944ca8b7f8][Make prompts more or less colorful]].
    771 
    772 ** Option for completion framework aesthetics
    773 :properties:
    774 :alt_title: Completion UIs
    775 :description: Choose among several styles for completion UIs
    776 :custom_id: h:f1c20c02-7b34-4c35-9c65-99170efb2882
    777 :end:
    778 #+vindex: modus-themes-completions
    779 
    780 Brief: Set the overall style of completion framework interfaces.
    781 
    782 Symbol: ~modus-themes-completions~ (=alist= type properties)
    783 
    784 This affects Company, Corfu, Flx, Icomplete/Fido, Ido, Ivy, Orderless,
    785 Vertico, and the standard =*Completions*= buffer.  The value is an
    786 alist of expressions, each of which takes the form of =(KEY . LIST-OF-PROPERTIES)=.
    787 =KEY= is a symbol, while =PROPERTIES= is a list.  Here is a sample,
    788 followed by a description of the particularities:
    789 
    790 #+begin_src emacs-lisp
    791 (setq modus-themes-completions
    792       '((matches . (extrabold underline))
    793         (selection . (semibold italic))))
    794 #+end_src
    795 
    796 The ~matches~ key refers to the highlighted characters that correspond
    797 to the user's input.  When its properties are ~nil~ or an empty list,
    798 matching characters in the user interface will have a bold weight and
    799 a colored foreground.  The list of properties may include any of the
    800 following symbols regardless of the order they may appear in:
    801 
    802 - ~underline~ to draw a line below the characters;
    803 
    804 - ~italic~ to use a slanted font (italic or oblique forms);
    805 
    806 - The symbol of a font weight attribute such as ~light~,
    807   ~semibold~, et cetera.  Valid symbols are defined in the
    808   variable ~modus-themes-weights~.  The absence of a weight means
    809   that bold will be used.
    810 
    811 The ~selection~ key applies to the current line or currently matched
    812 candidate, depending on the specifics of the user interface.  When its
    813 properties are ~nil~ or an empty list, it has a subtle gray background,
    814 a bold weight, and the base foreground value for the text.  The list
    815 of properties it accepts is as follows (order is not significant):
    816 
    817 - ~underline~ to draw a line below the characters;
    818 
    819 - ~italic~ to use a slanted font (italic or oblique forms);
    820 
    821 - The symbol of a font weight attribute such as ~light~,
    822   ~semibold~, et cetera.  Valid symbols are defined in the
    823   variable ~modus-themes-weights~.  The absence of a weight means
    824   that bold will be used.
    825 
    826 Apart from specifying each key separately, a catch-all list is
    827 accepted.  This is only useful when the desired aesthetic is the same
    828 across all keys that are not explicitly referenced.  For example,
    829 this:
    830 
    831 #+begin_src emacs-lisp
    832 (setq modus-themes-completions
    833       '((t . (extrabold underline))))
    834 #+end_src
    835 
    836 Is the same as:
    837 
    838 #+begin_src emacs-lisp
    839 (setq modus-themes-completions
    840       '((matches . (extrabold underline))
    841         (selection . (extrabold underline))))
    842 #+end_src
    843 
    844 [[#h:d959f789-0517-4636-8780-18123f936f91][Make completion matches more or less colorful]].
    845 
    846 ** Option for org-mode block styles
    847 :properties:
    848 :alt_title: Org mode blocks
    849 :description: Choose among plain, gray, or tinted backgrounds
    850 :custom_id: h:b7e328c0-3034-4db7-9cdf-d5ba12081ca2
    851 :end:
    852 #+vindex: modus-themes-org-blocks
    853 
    854 Brief: Set the overall style of Org code blocks, quotes, and the like.
    855 
    856 Symbol: ~modus-themes-org-blocks~ (=choice= type)
    857 
    858 Possible values:
    859 
    860 1. ~nil~ (default)
    861 2. ~gray-background~
    862 3. ~tinted-background~
    863 
    864 Option ~nil~ (the default) means that the block has no background of
    865 its own: it uses the one that applies to the rest of the buffer.
    866 In this case, the delimiter lines have a gray color for their text,
    867 making them look exactly like all other Org properties.
    868 
    869 Option ~gray-background~ applies a subtle gray background to the
    870 block's contents.  It also affects the begin and end lines of the
    871 block as they get another shade of gray as their background, which
    872 differentiates them from the contents of the block.  All background
    873 colors extend to the edge of the window, giving the area a
    874 rectangular, "blocky" presentation.  If the begin/end lines do not
    875 extend in this way, check the value of the Org user option
    876 ~org-fontify-whole-block-delimiter-line~.
    877 
    878 Option ~tinted-background~ uses a colored background for the contents
    879 of the block.  The exact color value will depend on the programming
    880 language and is controlled by the variable ~org-src-block-faces~
    881 (refer to the theme's source code for the current association list).
    882 For this to take effect, the Org buffer needs to be restarted with
    883 ~org-mode-restart~.
    884 
    885 Code blocks use their major mode's fontification (syntax highlighting)
    886 only when the variable ~org-src-fontify-natively~ is non-~nil~.  While
    887 quote/verse blocks require setting
    888 ~org-fontify-quote-and-verse-blocks~ to a non-~nil~ value.
    889 
    890 [[#h:f44cc6e3-b0f1-4a5e-8a90-9e48fa557b50][Update Org block delimiter fontification]].
    891 
    892 ** Option for the headings' overall style
    893 :properties:
    894 :alt_title: Heading styles
    895 :description: Choose among several styles, also per heading level
    896 :custom_id: h:271eff19-97aa-4090-9415-a6463c2f9ae1
    897 :end:
    898 #+vindex: modus-themes-headings
    899 
    900 Brief: Heading styles with optional list of values per heading level.
    901 
    902 Symbol: ~modus-themes-headings~ (=alist= type, multiple properties)
    903 
    904 This is an alist that accepts a =(KEY . LIST-OF-VALUES)= combination.
    905 The =KEY= is either a number, representing the heading's level (0
    906 through 8) or ~t~, which pertains to the fallback style.  The named
    907 keys =agenda-date= and =agenda-structure= apply to the Org agenda.
    908 
    909 Level 0 is a special heading: it is used for what counts as a document
    910 title or equivalent, such as the =#+title= construct we find in Org
    911 files.  Levels 1-8 are regular headings.
    912 
    913 The =LIST-OF-VALUES= covers symbols that refer to properties, as
    914 described below.  Here is a complete sample with various stylistic
    915 combinations, followed by a presentation of all available properties:
    916 
    917 #+begin_src emacs-lisp
    918 (setq modus-themes-headings
    919       '((1 . (variable-pitch 1.5))
    920         (2 . (1.3))
    921         (agenda-date . (1.3))
    922         (agenda-structure . (variable-pitch light 1.8))
    923         (t . (1.1))))
    924 #+end_src
    925 
    926 Properties:
    927 
    928 + A font weight, which must be supported by the underlying typeface:
    929   - ~thin~
    930   - ~ultralight~
    931   - ~extralight~
    932   - ~light~
    933   - ~semilight~
    934   - ~regular~
    935   - ~medium~
    936   - ~semibold~
    937   - ~bold~ (default)
    938   - ~heavy~
    939   - ~extrabold~
    940   - ~ultrabold~
    941 + A floating point as a height multiple of the default or a cons cell in
    942   the form of =(height . FLOAT)=.
    943 
    944 By default (a ~nil~ value for this variable), all headings have a bold
    945 typographic weight and use a desaturated text color.
    946 
    947 A ~variable-pitch~ property changes the font family of the heading to that
    948 of the ~variable-pitch~ face (normally a proportionately spaced typeface).
    949 
    950 The symbol of a weight attribute adjusts the font of the heading
    951 accordingly, such as ~light~, ~semibold~, etc.  Valid symbols are
    952 defined in the variable ~modus-themes-weights~.  The absence of a weight
    953 means that bold will be used by virtue of inheriting the ~bold~ face.
    954 
    955 [[#h:2793a224-2109-4f61-a106-721c57c01375][Configure bold and italic faces]].
    956 
    957 A number, expressed as a floating point (e.g. 1.5), adjusts the height
    958 of the heading to that many times the base font size.  The default
    959 height is the same as 1.0, though it need not be explicitly stated.
    960 Instead of a floating point, an acceptable value can be in the form of a
    961 cons cell like =(height . FLOAT)= or =(height FLOAT)=, where FLOAT is
    962 the given number.
    963 
    964 Combinations of any of those properties are expressed as a list, like in
    965 these examples:
    966 
    967 #+begin_src emacs-lisp
    968 (semibold)
    969 (variable-pitch semibold 1.3)
    970 (variable-pitch semibold (height 1.3)) ; same as above
    971 (variable-pitch semibold (height . 1.3)) ; same as above
    972 #+end_src
    973 
    974 The order in which the properties are set is not significant.
    975 
    976 In user configuration files the form may look like this:
    977 
    978 #+begin_src emacs-lisp
    979 (setq modus-themes-headings
    980       '((1 . (variable-pitch 1.5))
    981         (2 . (1.3))
    982         (agenda-date . (1.3))
    983         (agenda-structure . (variable-pitch light 1.8))
    984         (t . (1.1))))
    985 #+end_src
    986 
    987 When defining the styles per heading level, it is possible to pass a
    988 non-~nil~ value (~t~) instead of a list of properties.  This will retain the
    989 original aesthetic for that level.  For example:
    990 
    991 #+begin_src emacs-lisp
    992 (setq modus-themes-headings
    993       '((1 . t)           ; keep the default style
    994         (2 . (semibold 1.2))
    995         (t . (rainbow)))) ; style for all other headings
    996 
    997 (setq modus-themes-headings
    998       '((1 . (variable-pitch 1.5))
    999         (2 . (semibold))
   1000         (t . t))) ; default style for all other levels
   1001 #+end_src
   1002 
   1003 Note that the text color of headings, of their background, and
   1004 overline can all be set via the overrides.  It is possible to have any
   1005 color combination for any heading level (something that could not be
   1006 done in older versions of the themes).
   1007 
   1008 [[#h:34c7a691-19bb-4037-8d2f-67a07edab150][Option for palette overrides]].
   1009 
   1010 [[#h:11297984-85ea-4678-abe9-a73aeab4676a][Make headings more or less colorful]].
   1011 
   1012 ** Option for variable-pitch font in UI elements
   1013 :properties:
   1014 :alt_title: UI typeface
   1015 :description: Toggle the use of variable-pitch across the User Interface
   1016 :custom_id: h:16cf666c-5e65-424c-a855-7ea8a4a1fcac
   1017 :end:
   1018 #+vindex: modus-themes-variable-pitch-ui
   1019 
   1020 Brief: Toggle the use of proportionately spaced (~variable-pitch~) fonts
   1021 in the User Interface.
   1022 
   1023 Symbol: ~modus-themes-variable-pitch-ui~ (=boolean= type)
   1024 
   1025 Possible values:
   1026 
   1027 1. ~nil~ (default)
   1028 2. ~t~
   1029 
   1030 This option concerns User Interface elements that are under the direct
   1031 control of Emacs.  In particular: the mode line, header line, tab bar,
   1032 and tab line.
   1033 
   1034 The default is to use the same font as the rest of Emacs, which usually
   1035 is a monospaced family.
   1036 
   1037 With a non-~nil~ value (~t~) apply a proportionately spaced typeface.  This
   1038 is done by assigning the ~variable-pitch~ face to the relevant items.
   1039 
   1040 [[#h:defcf4fc-8fa8-4c29-b12e-7119582cc929][Font configurations for Org and others]].
   1041 
   1042 ** Option for palette overrides
   1043 :properties:
   1044 :alt_title: Palette overrides
   1045 :description: Refashion color values and/or semantic color mappings
   1046 :custom_id: h:34c7a691-19bb-4037-8d2f-67a07edab150
   1047 :end:
   1048 
   1049 This section describes palette overrides in detail.  For a simpler
   1050 alternative, use the presets we provide ([[#h:b0bc811c-227e-42ec-bf67-15e1f41eb7bc][Palette override presets]]).
   1051 
   1052 Each Modus theme specifies a color palette that declares named color
   1053 values and semantic color mappings:
   1054 
   1055 + Named colors consist of a symbol and a string that specifies a
   1056   hexadecimal RGB value.  For example: =(blue-warmer "#354fcf")=.
   1057 
   1058 + The semantic color mappings associate an abstract construct with a
   1059   given named color from the palette, like =(heading-2 yellow-faint)=.
   1060   Both elements of the list are symbols, though the ~cadr~ (value) can
   1061   be a string that specifies a color, such as =(heading-2 "#354fcf")=.
   1062 
   1063 #+vindex: modus-themes-common-palette-overrides
   1064 Both of those subsets can be overridden, thus refashioning the theme.
   1065 Overrides are either shared, by being stored in the user option
   1066 ~modus-themes-common-palette-overrides~, or they are specific to the
   1067 theme they name.  In the latter case, the naming scheme of each
   1068 palette variable is =THEME-NAME-palette-overrides=, thus yielding:
   1069 
   1070 #+vindex: modus-operandi-palette-overrides
   1071 + ~modus-operandi-palette-overrides~
   1072 
   1073 #+vindex: modus-operandi-deuteranopia-palette-overrides
   1074 + ~modus-operandi-deuteranopia-palette-overrides~
   1075 
   1076 #+vindex: modus-operandi-tinted-palette-overrides
   1077 + ~modus-operandi-tinted-palette-overrides~
   1078 
   1079 #+vindex: modus-operandi-tritanopia-palette-overrides
   1080 + ~modus-operandi-tritanopia-palette-overrides~
   1081 
   1082 #+vindex: modus-vivendi-palette-overrides
   1083 + ~modus-vivendi-palette-overrides~
   1084 
   1085 #+vindex: modus-vivendi-deuteranopia-palette-overrides
   1086 + ~modus-vivendi-deuteranopia-palette-overrides~
   1087 
   1088 #+vindex: modus-vivendi-tinted-palette-overrides
   1089 + ~modus-vivendi-tinted-palette-overrides~
   1090 
   1091 #+vindex: modus-vivendi-tritanopia-palette-overrides
   1092 + ~modus-vivendi-tritanopia-palette-overrides~
   1093 
   1094 Theme-specific overrides take precedence over the shared ones.  It is
   1095 strongly advised that shared overrides do NOT alter color values, as
   1096 those will not be appropriate for both dark and light themes.  Common
   1097 overrides are best limited to the semantic color mappings as those use
   1098 the color value that corresponds to the active theme (e.g. make the
   1099 cursor =blue-warmer= in all themes, whatever the value of
   1100 =blue-warmer= is in each theme).
   1101 
   1102 The value of any overrides' variable must mirror a theme's palette.
   1103 Palette variables are named after their theme as =THEME-NAME-palette=.
   1104 For example, the ~modus-operandi-palette~ is like this:
   1105 
   1106 #+begin_src emacs-lisp
   1107 (defconst modus-operandi-palette
   1108     '(
   1109 ;;; Basic values
   1110 
   1111       (bg-main     "#ffffff")
   1112       (bg-dim      "#f0f0f0")
   1113       (fg-main     "#000000")
   1114 
   1115       ;; ...
   1116 
   1117       (red         "#a60000")
   1118       (red-warmer  "#972500")
   1119       (red-cooler  "#a0132f")
   1120       (red-faint   "#7f0000")
   1121       (red-intense "#d00000")
   1122 
   1123       ;; ...
   1124 
   1125 ;;;; Mappings
   1126 
   1127       ;; ...
   1128 
   1129       (cursor fg-main)
   1130       (builtin magenta-warmer)
   1131       (comment fg-dim)
   1132       (constant blue-cooler)
   1133       (docstring green-faint)
   1134       (fnname magenta)
   1135       (keyword magenta-cooler)
   1136 
   1137       ;; ...
   1138       ))
   1139 #+end_src
   1140 
   1141 The ~modus-operandi-palette-overrides~ targets the entries that need
   1142 to be changed.  For example, to make the main foreground color a dark
   1143 gray instead of pure black, use a shade of red for comments, and apply
   1144 a cyan hue to keywords:
   1145 
   1146 #+begin_src emacs-lisp
   1147 (setq modus-operandi-palette-overrides
   1148       '((fg-main "#333333")
   1149         (comment red-faint)
   1150         (keyword cyan-cooler)))
   1151 #+end_src
   1152 
   1153 Changes take effect upon theme reload ([[#h:9001527a-4e2c-43e0-98e8-3ef72d770639][Custom reload theme]]).
   1154 Overrides are removed by setting their variable to a ~nil~ value.
   1155 
   1156 The common accented foregrounds in each palette follow a predictable
   1157 naming scheme: =HUE{,-warmer,-cooler,-faint,-intense}=.  =HUE= is one
   1158 of the six basic colors: red, green, blue, yellow, magenta, cyan.
   1159 
   1160 Named colors that are meant to be used as backgrounds contain =bg= in
   1161 their name, such as =bg-red-intense=.  While special purpose
   1162 foregrounds that are meant to be combined with such backgrounds,
   1163 contain =fg= in their name, such as =fg-removed= which complements
   1164 =bg-removed=.
   1165 
   1166 Named colors can be previewed, such as with the command
   1167 ~modus-themes-list-colors~ ([[#h:f4d4b71b-2ca5-4c3d-b0b4-9bfd7aa7fb4d][Preview theme colors]]).
   1168 
   1169 For a video tutorial that users of all skill levels can approach,
   1170 watch: https://protesilaos.com/codelog/2022-12-17-modus-themes-v4-demo/.
   1171 
   1172 * Advanced customization
   1173 :properties:
   1174 :custom_id: h:f4651d55-8c07-46aa-b52b-bed1e53463bb
   1175 :end:
   1176 
   1177 Unlike the predefined customization options which follow a clear pattern
   1178 of allowing the user to quickly specify their preference, the themes
   1179 also provide a more flexible, albeit difficult, mechanism to control
   1180 things with precision ([[#h:bf1c82f2-46c7-4eb2-ad00-dd11fdd8b53f][Customization Options]]).
   1181 
   1182 This section is of interest only to users who are prepared to maintain
   1183 their own local tweaks and who are willing to deal with any possible
   1184 incompatibilities between versioned releases of the themes.  As such,
   1185 they are labeled as "do-it-yourself" or "DIY".
   1186 
   1187 ** Palette override presets
   1188 :PROPERTIES:
   1189 :CUSTOM_ID: h:b0bc811c-227e-42ec-bf67-15e1f41eb7bc
   1190 :END:
   1191 
   1192 This section shows how to refashion the themes by opting in to the
   1193 stylistic presets we provide.  Those presets override the default
   1194 color mappings to amplify, tone down, or refashion the overall
   1195 coloration of the themes.
   1196 
   1197 To make almost all aspects of the themes less intense, use this:
   1198 
   1199 #+begin_src emacs-lisp
   1200 ;; Always remember to reload the theme for changes to take effect!
   1201 (setq modus-themes-common-palette-overrides modus-themes-preset-overrides-faint)
   1202 #+end_src
   1203 
   1204 #+vindex: modus-themes-preset-overrides-faint
   1205 With ~modus-themes-preset-overrides-faint~ the grays are toned down,
   1206 gray backgrounds are removed from some contexts, and almost all accent
   1207 colors are desaturated.  It makes the themes less attention-grabbing.
   1208 
   1209 On the opposite end of the stylistic spectrum, we have this
   1210 
   1211 #+begin_src emacs-lisp
   1212 ;; Always remember to reload the theme for changes to take effect!
   1213 (setq modus-themes-common-palette-overrides modus-themes-preset-overrides-intense)
   1214 #+end_src
   1215 
   1216 #+vindex: modus-themes-preset-overrides-intense
   1217 The ~modus-themes-preset-overrides-intense~ makes many background
   1218 colors accented instead of gray and increases coloration in a number
   1219 of places.  Colors stand out more and are made easier to spot.
   1220 
   1221 #+vindex: modus-themes-preset-overrides-cooler
   1222 #+vindex: modus-themes-preset-overrides-warmer
   1223 For some stylistic variation try the "cooler" and "warmer" presets:
   1224 
   1225 #+begin_src emacs-lisp
   1226 ;; This:
   1227 (setq modus-themes-common-palette-overrides modus-themes-preset-overrides-cooler)
   1228 
   1229 ;; Or:
   1230 (setq modus-themes-common-palette-overrides modus-themes-preset-overrides-warmer)
   1231 #+end_src
   1232 
   1233 Note that the user is not limited to those presets.  The system of
   1234 overrides we provide makes it possible to tweak the value of each
   1235 individual named color and to change how values are assigned to
   1236 semantic color mappings ([[#h:34c7a691-19bb-4037-8d2f-67a07edab150][Option for palette overrides]]).  Subsequent
   1237 sections provide examples ([[#h:df1199d8-eaba-47db-805d-6b568a577bf3][Stylistic variants using palette overrides]]).
   1238 
   1239 It is also possible to use those presets as a basis and, for example,
   1240 add to them code from the subsequent sections of this manual.  This is
   1241 the general idea (extra space for didactic purposes):
   1242 
   1243 #+begin_src emacs-lisp
   1244 (setq modus-themes-common-palette-overrides
   1245       `(
   1246         ;; From the section "Make the mode line borderless"
   1247         (border-mode-line-active unspecified)
   1248         (border-mode-line-inactive unspecified)
   1249 
   1250         ;; From the section "Make matching parenthesis more or less intense"
   1251         (bg-paren-match bg-magenta-intense)
   1252         (underline-paren-match fg-main)
   1253 
   1254         ;; And expand the preset here.  Note that the ,@ works because
   1255         ;; we use the backtick for this list, instead of a straight
   1256         ;; quote.
   1257         ,@modus-themes-preset-overrides-intense))
   1258 #+end_src
   1259 
   1260 ** Stylistic variants using palette overrides
   1261 :PROPERTIES:
   1262 :CUSTOM_ID: h:df1199d8-eaba-47db-805d-6b568a577bf3
   1263 :END:
   1264 
   1265 This section contains practical examples of overriding the palette of
   1266 the themes ([[#h:34c7a691-19bb-4037-8d2f-67a07edab150][Option for palette overrides]]).  Users can copy the code to
   1267 their init file, evaluate it, and then re-load the theme for changes
   1268 to take effect.  To apply overrides at startup simply define them
   1269 before the call that loads the theme.  Remember that we also provide
   1270 presets that are easier to apply ([[#h:b0bc811c-227e-42ec-bf67-15e1f41eb7bc][Palette override presets]]).
   1271 
   1272 *** Make the mode line borderless
   1273 :PROPERTIES:
   1274 :CUSTOM_ID: h:80ddba52-e188-411f-8cc0-480ebd75befe
   1275 :END:
   1276 
   1277 This is one of our practical examples to override the semantic colors
   1278 of the Modus themes ([[#h:df1199d8-eaba-47db-805d-6b568a577bf3][Stylistic variants using palette overrides]]).  To
   1279 hide the border around the active and inactive mode lines, we need to
   1280 set their color to that of the underlying background.
   1281 
   1282 [[#h:e8d781be-eefc-4a81-ac4e-5ed156190df7][Make the active mode line colorful]].
   1283 
   1284 [[#h:5a0c58cc-f97f-429c-be08-927b9fbb0a9c][Add padding to mode line]].
   1285 
   1286 #+begin_src emacs-lisp
   1287 ;; These overrides are common to all Modus themes.  We also provide
   1288 ;; theme-specific options, such as `modus-operandi-palette-overrides'.
   1289 ;;
   1290 ;; In general, the theme-specific overrides are better for overriding
   1291 ;; color values, such as redefining what `blue-faint' looks like.  The
   1292 ;; common overrides are best used for changes to semantic color
   1293 ;; mappings, as we show below.
   1294 
   1295 ;; Remove the border
   1296 (setq modus-themes-common-palette-overrides
   1297       '((border-mode-line-active unspecified)
   1298         (border-mode-line-inactive unspecified)))
   1299 
   1300 ;; Keep the border but make it the same color as the background of the
   1301 ;; mode line (thus appearing borderless).  The difference with the
   1302 ;; above is that this version is a bit thicker because the border are
   1303 ;; still there.
   1304 (setq modus-themes-common-palette-overrides
   1305       '((border-mode-line-active bg-mode-line-active)
   1306         (border-mode-line-inactive bg-mode-line-inactive)))
   1307 #+end_src
   1308 
   1309 *** Make the active mode line colorful
   1310 :PROPERTIES:
   1311 :CUSTOM_ID: h:e8d781be-eefc-4a81-ac4e-5ed156190df7
   1312 :END:
   1313 
   1314 This is one of our practical examples to override the semantic colors
   1315 of the Modus themes ([[#h:df1199d8-eaba-47db-805d-6b568a577bf3][Stylistic variants using palette overrides]]).
   1316 Here we show some snippets that apply different stylistic variants.
   1317 Of course, it is possible to use theme-specific overrides to, say,
   1318 have a blue mode line for ~modus-operandi~ and a red one for
   1319 ~modus-vivendi~.
   1320 
   1321 [[#h:80ddba52-e188-411f-8cc0-480ebd75befe][Make the mode line borderless]].
   1322 
   1323 [[#h:5a0c58cc-f97f-429c-be08-927b9fbb0a9c][Add padding to mode line]].
   1324 
   1325 #+begin_src emacs-lisp
   1326 ;; These overrides are common to all Modus themes.  We also provide
   1327 ;; theme-specific options, such as `modus-operandi-palette-overrides'.
   1328 ;;
   1329 ;; In general, the theme-specific overrides are better for overriding
   1330 ;; color values, such as redefining what `blue-faint' looks like.  The
   1331 ;; common overrides are best used for changes to semantic color
   1332 ;; mappings, as we show below.
   1333 
   1334 ;; Blue background, neutral foreground, intense blue border
   1335 (setq modus-themes-common-palette-overrides
   1336       '((bg-mode-line-active bg-blue-intense)
   1337         (fg-mode-line-active fg-main)
   1338         (border-mode-line-active blue-intense)))
   1339 
   1340 ;; Subtle blue background, neutral foreground, intense blue border
   1341 (setq modus-themes-common-palette-overrides
   1342       '((bg-mode-line-active bg-blue-subtle)
   1343         (fg-mode-line-active fg-main)
   1344         (border-mode-line-active blue-intense)))
   1345 
   1346 ;; Subtle red background, red foreground, invisible border
   1347 (setq modus-themes-common-palette-overrides
   1348       '((bg-mode-line-active bg-red-subtle)
   1349         (fg-mode-line-active red-warmer)
   1350         (border-mode-line-active bg-red-subtle)))
   1351 #+end_src
   1352 
   1353 *** Make the tab bar more or less colorful
   1354 :PROPERTIES:
   1355 :CUSTOM_ID: h:096658d7-a0bd-4a99-b6dc-9b20a20cda37
   1356 :END:
   1357 
   1358 This is one of our practical examples to override the semantic colors
   1359 of the Modus themes ([[#h:df1199d8-eaba-47db-805d-6b568a577bf3][Stylistic variants using palette overrides]]).
   1360 Here we show how to affect the colors of the built-in ~tab-bar-mode~
   1361 and ~tab-line-mode~.
   1362 
   1363 For consistent theme-wide results, consider changing the mode line,
   1364 fringes, and line numbers.  These are shown in other sections of this
   1365 manual.
   1366 
   1367 #+begin_src emacs-lisp
   1368 ;; These overrides are common to all Modus themes.  We also provide
   1369 ;; theme-specific options, such as `modus-operandi-palette-overrides'.
   1370 ;;
   1371 ;; In general, the theme-specific overrides are better for overriding
   1372 ;; color values, such as redefining what `blue-faint' looks like.  The
   1373 ;; common overrides are best used for changes to semantic color
   1374 ;; mappings, as we show below.
   1375 
   1376 
   1377 ;; Make the `tab-bar-mode' mode subtle while keepings its original
   1378 ;; gray aesthetic.
   1379 (setq modus-themes-common-palette-overrides
   1380       '((bg-tab-bar bg-main)
   1381         (bg-tab-current bg-active)
   1382         (bg-tab-other bg-dim)))
   1383 
   1384 ;; Like the above, but the current tab has a colorful background and
   1385 ;; the inactive tabs have a slightly more noticeable gray background.
   1386 (setq modus-themes-common-palette-overrides
   1387       '((bg-tab-bar bg-main)
   1388         (bg-tab-current bg-cyan-intense)
   1389         (bg-tab-other bg-inactive)))
   1390 
   1391 ;; Make the tabs colorful, using a monochromatic pattern (e.g. shades
   1392 ;; of cyan).
   1393 (setq modus-themes-common-palette-overrides
   1394       '((bg-tab-bar bg-cyan-nuanced)
   1395         (bg-tab-current bg-cyan-intense)
   1396         (bg-tab-other bg-cyan-subtle)))
   1397 
   1398 ;; Like the above, but with a dichromatic pattern (cyan and magenta).
   1399 (setq modus-themes-common-palette-overrides
   1400       '((bg-tab-bar bg-cyan-nuanced)
   1401         (bg-tab-current bg-magenta-intense)
   1402         (bg-tab-other bg-cyan-subtle)))
   1403 #+end_src
   1404 
   1405 *** Make the fringe invisible or another color
   1406 :PROPERTIES:
   1407 :CUSTOM_ID: h:c312dcac-36b6-4a1f-b1f5-ab1c9abe27b0
   1408 :END:
   1409 
   1410 This is one of our practical examples to override the semantic colors
   1411 of the Modus themes ([[#h:df1199d8-eaba-47db-805d-6b568a577bf3][Stylistic variants using palette overrides]]).
   1412 Here we show how to make the fringe invisible or how to assign to it a
   1413 different color.  The "fringe" is a small area to the right and left
   1414 side of the Emacs window which shows indicators such as for truncation
   1415 or continuation lines.
   1416 
   1417 #+begin_src emacs-lisp
   1418 ;; These overrides are common to all Modus themes.  We also provide
   1419 ;; theme-specific options, such as `modus-operandi-palette-overrides'.
   1420 ;;
   1421 ;; In general, the theme-specific overrides are better for overriding
   1422 ;; color values, such as redefining what `blue-faint' looks like.  The
   1423 ;; common overrides are best used for changes to semantic color
   1424 ;; mappings, as we show below.
   1425 
   1426 ;; Make the fringe invisible
   1427 (setq modus-themes-common-palette-overrides
   1428       '((fringe unspecified)))
   1429 
   1430 ;; Make the fringe more intense
   1431 (setq modus-themes-common-palette-overrides
   1432       '((fringe bg-active)))
   1433 
   1434 ;; Make the fringe colorful, but nuanced
   1435 (setq modus-themes-common-palette-overrides
   1436       '((fringe bg-blue-nuanced)))
   1437 #+end_src
   1438 
   1439 *** Make links use subtle or no underlines
   1440 :PROPERTIES:
   1441 :CUSTOM_ID: h:6c1d1dea-5cbf-4d92-b7bb-570a7a23ffe9
   1442 :END:
   1443 
   1444 This is one of our practical examples to override the semantic colors
   1445 of the Modus themes ([[#h:df1199d8-eaba-47db-805d-6b568a577bf3][Stylistic variants using palette overrides]]).  In
   1446 this example, we showcase the special use of the ~unspecified~ symbol
   1447 that underline mappings can read correctly.
   1448 
   1449 #+begin_src emacs-lisp
   1450 ;; Subtle underlines
   1451 (setq modus-themes-common-palette-overrides
   1452       '((underline-link border)
   1453         (underline-link-visited border)
   1454         (underline-link-symbolic border)))
   1455 
   1456 ;; No underlines
   1457 (setq modus-themes-common-palette-overrides
   1458       '((underline-link unspecified)
   1459         (underline-link-visited unspecified)
   1460         (underline-link-symbolic unspecified)))
   1461 #+end_src
   1462 
   1463 *** Make prompts more or less colorful
   1464 :PROPERTIES:
   1465 :CUSTOM_ID: h:bd75b43a-0bf1-45e7-b8b4-20944ca8b7f8
   1466 :END:
   1467 
   1468 This section contains practical examples of overriding the palette of
   1469 the themes ([[#h:34c7a691-19bb-4037-8d2f-67a07edab150][Option for palette overrides]]).  In the following code
   1470 block we show how to add or remove color from prompts.
   1471 
   1472 [[#h:db5a9a7c-2928-4a28-b0f0-6f2b9bd52ba1][Option for command prompt styles]].
   1473 
   1474 #+begin_src emacs-lisp
   1475 ;; These overrides are common to all Modus themes.  We also provide
   1476 ;; theme-specific options, such as `modus-operandi-palette-overrides'.
   1477 ;;
   1478 ;; In general, the theme-specific overrides are better for overriding
   1479 ;; color values, such as redefining what `blue-faint' looks like.  The
   1480 ;; common overrides are best used for changes to semantic color
   1481 ;; mappings, as we show below.
   1482 
   1483 ;; Keep the background unspecified (like the default), but use a faint
   1484 ;; foreground color.
   1485 (setq modus-themes-common-palette-overrides
   1486       '((fg-prompt cyan-faint)
   1487         (bg-prompt unspecified)))
   1488 
   1489 ;; Add a nuanced background to prompts that complements their foreground.
   1490 (setq modus-themes-common-palette-overrides
   1491       '((fg-prompt cyan)
   1492         (bg-prompt bg-cyan-nuanced)))
   1493 
   1494 ;; Add a yellow background and adjust the foreground accordingly.
   1495 (setq modus-themes-common-palette-overrides
   1496       '((fg-prompt fg-main)
   1497         (bg-prompt bg-yellow-subtle))) ; try to replace "subtle" with "intense"
   1498 #+end_src
   1499 
   1500 *** Make completion matches more or less colorful
   1501 :PROPERTIES:
   1502 :CUSTOM_ID: h:d959f789-0517-4636-8780-18123f936f91
   1503 :END:
   1504 
   1505 This section contains practical examples of overriding the palette of
   1506 the themes ([[#h:34c7a691-19bb-4037-8d2f-67a07edab150][Option for palette overrides]]).   Here we demonstrate how
   1507 to activate background coloration for completion matches.  We show
   1508 three different degrees of intensity.
   1509 
   1510 [[#h:f1c20c02-7b34-4c35-9c65-99170efb2882][Option for completion framework aesthetics]].
   1511 
   1512 #+begin_src emacs-lisp
   1513 ;; These overrides are common to all Modus themes.  We also provide
   1514 ;; theme-specific options, such as `modus-operandi-palette-overrides'.
   1515 ;;
   1516 ;; In general, the theme-specific overrides are better for overriding
   1517 ;; color values, such as redefining what `blue-faint' looks like.  The
   1518 ;; common overrides are best used for changes to semantic color
   1519 ;; mappings, as we show below.
   1520 
   1521 ;; Add a nuanced background color to completion matches, while keeping
   1522 ;; their foreground intact (foregrounds do not need to be specified in
   1523 ;; this case, but we do it for didactic purposes).
   1524 (setq modus-themes-common-palette-overrides
   1525       '((fg-completion-match-0 blue)
   1526         (fg-completion-match-1 magenta-warmer)
   1527         (fg-completion-match-2 cyan)
   1528         (fg-completion-match-3 red)
   1529         (bg-completion-match-0 bg-blue-nuanced)
   1530         (bg-completion-match-1 bg-magenta-nuanced)
   1531         (bg-completion-match-2 bg-cyan-nuanced)
   1532         (bg-completion-match-3 bg-red-nuanced)))
   1533 
   1534 ;; Add intense background colors to completion matches and adjust the
   1535 ;; foregrounds accordingly.
   1536 (setq modus-themes-common-palette-overrides
   1537       '((fg-completion-match-0 fg-main)
   1538         (fg-completion-match-1 fg-main)
   1539         (fg-completion-match-2 fg-main)
   1540         (fg-completion-match-3 fg-main)
   1541         (bg-completion-match-0 bg-blue-intense)
   1542         (bg-completion-match-1 bg-yellow-intense)
   1543         (bg-completion-match-2 bg-cyan-intense)
   1544         (bg-completion-match-3 bg-red-intense)))
   1545 
   1546 ;; Like the above, but with subtle backgrounds.
   1547 (setq modus-themes-common-palette-overrides
   1548       '((fg-completion-match-0 fg-main)
   1549         (fg-completion-match-1 fg-main)
   1550         (fg-completion-match-2 fg-main)
   1551         (fg-completion-match-3 fg-main)
   1552         (bg-completion-match-0 bg-blue-subtle)
   1553         (bg-completion-match-1 bg-yellow-subtle)
   1554         (bg-completion-match-2 bg-cyan-subtle)
   1555         (bg-completion-match-3 bg-red-subtle)))
   1556 #+end_src
   1557 
   1558 Adding to the above, it is possible to, say, reduce the number of
   1559 colors to two:
   1560 
   1561 #+begin_src emacs-lisp
   1562 ;; No backgrounds (like the default) and just use two colors.
   1563 (setq modus-themes-common-palette-overrides
   1564       '((fg-completion-match-0 blue)
   1565         (fg-completion-match-1 yellow)
   1566         (fg-completion-match-2 blue)
   1567         (fg-completion-match-3 yellow)
   1568         (bg-completion-match-0 unspecified)
   1569         (bg-completion-match-1 unspecified)
   1570         (bg-completion-match-2 unspecified)
   1571         (bg-completion-match-3 unspecified)))
   1572 
   1573 ;; Again, a two-color style but this time with backgrounds
   1574 (setq modus-themes-common-palette-overrides
   1575       '((fg-completion-match-0 blue)
   1576         (fg-completion-match-1 yellow)
   1577         (fg-completion-match-2 blue)
   1578         (fg-completion-match-3 yellow)
   1579         (bg-completion-match-0 bg-blue-nuanced)
   1580         (bg-completion-match-1 bg-yellow-nuanced)
   1581         (bg-completion-match-2 bg-blue-nuanced)
   1582         (bg-completion-match-3 bg-yellow-nuanced)))
   1583 #+end_src
   1584 
   1585 The user can mix and match to their liking.
   1586 
   1587 *** Make comments yellow and strings green
   1588 :PROPERTIES:
   1589 :CUSTOM_ID: h:26f53daa-0065-48dc-88ab-6a718d16cd95
   1590 :END:
   1591 
   1592 This is one of our practical examples to override the semantic colors
   1593 of the Modus themes ([[#h:df1199d8-eaba-47db-805d-6b568a577bf3][Stylistic variants using palette overrides]]).  In
   1594 previous versions of the themes, we provided an option for yellow-ish
   1595 comments and green-ish strings.  For some users, those were still not
   1596 good enough, as the exact values were hardcoded.  Here we show how to
   1597 reproduce the effect, but also how to tweak it to one's liking.
   1598 
   1599 [[#h:c8767172-bf11-4c96-81dc-e736c464fc9c][Make code syntax use the old alt-syntax style]].
   1600 
   1601 [[#h:943063da-7b27-4ba4-9afe-f8fe77652fd1][Make use of alternative styles for code syntax]].
   1602 
   1603 #+begin_src emacs-lisp
   1604 ;; These overrides are common to all Modus themes.  We also provide
   1605 ;; theme-specific options, such as `modus-operandi-palette-overrides'.
   1606 ;;
   1607 ;; In general, the theme-specific overrides are better for overriding
   1608 ;; color values, such as redefining what `blue-faint' looks like.  The
   1609 ;; common overrides are best used for changes to semantic color
   1610 ;; mappings, as we show below.
   1611 
   1612 ;; Yellow comments and green strings like older versions of the Modus
   1613 ;; themes
   1614 (setq modus-themes-common-palette-overrides
   1615       '((comment yellow-cooler)
   1616         (string green-cooler)))
   1617 
   1618 ;; Faint yellow comments and a different shade of green for strings
   1619 (setq modus-themes-common-palette-overrides
   1620       '((comment yellow-faint)
   1621         (string green-warmer)))
   1622 
   1623 ;; Green comments and yellow strings, because now the user has the
   1624 ;; freedom to do it
   1625 (setq modus-themes-common-palette-overrides
   1626       '((comment green)
   1627         (string yellow-cooler)))
   1628 #+end_src
   1629 
   1630 *** Make code syntax use the old alt-syntax style
   1631 :PROPERTIES:
   1632 :CUSTOM_ID: h:c8767172-bf11-4c96-81dc-e736c464fc9c
   1633 :END:
   1634 
   1635 This is one of our practical examples to override the semantic colors
   1636 of the Modus themes ([[#h:df1199d8-eaba-47db-805d-6b568a577bf3][Stylistic variants using palette overrides]]).  In
   1637 this section we show how to reproduce what previous versions of the
   1638 Modus themes provided as a stylistic alternative for code syntax.  The
   1639 upside of using overrides for this purpose is that we can tweak the
   1640 style to our liking, but first let's start with its recreation:
   1641 
   1642 #+begin_src emacs-lisp
   1643 ;; These overrides are common to all Modus themes.  We also provide
   1644 ;; theme-specific options, such as `modus-operandi-palette-overrides'.
   1645 ;;
   1646 ;; In general, the theme-specific overrides are better for overriding
   1647 ;; color values, such as redefining what `blue-faint' looks like.  The
   1648 ;; common overrides are best used for changes to semantic color
   1649 ;; mappings, as we show below.
   1650 
   1651 
   1652 ;; The old "alt-syntax"
   1653 (setq modus-themes-common-palette-overrides
   1654       '((builtin magenta)
   1655         (comment fg-dim)
   1656         (constant magenta-cooler)
   1657         (docstring magenta-faint)
   1658         (docmarkup green-faint)
   1659         (fnname magenta-warmer)
   1660         (keyword cyan)
   1661         (preprocessor cyan-cooler)
   1662         (string red-cooler)
   1663         (type magenta-cooler)
   1664         (variable blue-warmer)
   1665         (rx-construct magenta-warmer)
   1666         (rx-backslash blue-cooler)))
   1667 #+end_src
   1668 
   1669 The "alt-syntax" could optionally use green strings and yellow
   1670 comments ([[#h:26f53daa-0065-48dc-88ab-6a718d16cd95][Make comments yellow and strings green]]):
   1671 
   1672 #+begin_src emacs-lisp
   1673 ;; Same as above, but with yellow comments and green strings
   1674 (setq modus-themes-common-palette-overrides
   1675       '((builtin magenta)
   1676         (comment yellow-faint)
   1677         (constant magenta-cooler)
   1678         (docstring green-faint)
   1679         (docmarkup magenta-faint)
   1680         (fnname magenta-warmer)
   1681         (keyword cyan)
   1682         (preprocessor cyan-cooler)
   1683         (string green-cooler)
   1684         (type magenta-cooler)
   1685         (variable blue-warmer)
   1686         (rx-construct magenta-warmer)
   1687         (rx-backslash blue-cooler)))
   1688 #+end_src
   1689 
   1690 The standard "alt-syntax" has red strings.  As such, it is interesting
   1691 to experiment with faintly red colored comments:
   1692 
   1693 #+begin_src emacs-lisp
   1694 ;; Like the old "alt-syntax" but with faint red comments
   1695 (setq modus-themes-common-palette-overrides
   1696       '((builtin magenta)
   1697         (comment red-faint)
   1698         (constant magenta-cooler)
   1699         (docstring magenta-faint)
   1700         (docmarkup green-faint)
   1701         (fnname magenta-warmer)
   1702         (keyword cyan)
   1703         (preprocessor cyan-cooler)
   1704         (string red-cooler)
   1705         (type magenta-cooler)
   1706         (variable blue-warmer)
   1707         (rx-construct magenta-warmer)
   1708         (rx-backslash blue-cooler)))
   1709 #+end_src
   1710 
   1711 The user can always mix and match styles to their liking.
   1712 
   1713 [[#h:943063da-7b27-4ba4-9afe-f8fe77652fd1][Make use of alternative styles for code syntax]].
   1714 
   1715 *** Make use of alternative styles for code syntax
   1716 :PROPERTIES:
   1717 :CUSTOM_ID: h:943063da-7b27-4ba4-9afe-f8fe77652fd1
   1718 :END:
   1719 
   1720 This is one of our practical examples to override the semantic colors
   1721 of the Modus themes ([[#h:df1199d8-eaba-47db-805d-6b568a577bf3][Stylistic variants using palette overrides]]).  The
   1722 idea here is to change how named colors are mapped to code syntax.
   1723 Each of the following snippets give the ~modus-themes~ a different
   1724 feel while editing code.
   1725 
   1726 Note that my ~modus-themes~ and ~ef-themes~ do not use the same
   1727 palettes, so some things are different.  If you copy from the latter
   1728 to the former, double-check that the entries exist in the given Modus
   1729 theme palette.
   1730 
   1731 [[#h:26f53daa-0065-48dc-88ab-6a718d16cd95][Make comments yellow and strings green]].
   1732 
   1733 [[*Make code syntax use the old alt-syntax style][Make code syntax use the old alt-syntax style]].
   1734 
   1735 #+begin_src emacs-lisp
   1736 ;; These overrides are common to all Modus themes.  We also provide
   1737 ;; theme-specific options, such as `modus-operandi-palette-overrides'.
   1738 ;;
   1739 ;; In general, the theme-specific overrides are better for overriding
   1740 ;; color values, such as redefining what `blue-faint' looks like.  The
   1741 ;; common overrides are best used for changes to semantic color
   1742 ;; mappings, as we show below.
   1743 
   1744 
   1745 ;; Mimic `ef-night' theme (from my `ef-themes') for code syntax
   1746 ;; highlighting, while still using the Modus colors (and other
   1747 ;; mappings).
   1748 (setq modus-themes-common-palette-overrides
   1749       '((builtin green-cooler)
   1750         (comment yellow-faint)
   1751         (constant magenta-cooler)
   1752         (fnname cyan-cooler)
   1753         (keyword blue-warmer)
   1754         (preprocessor red-warmer)
   1755         (docstring cyan-faint)
   1756         (string blue-cooler)
   1757         (type magenta-cooler)
   1758         (variable cyan)))
   1759 
   1760 ;; Mimic `ef-summer' theme (from my `ef-themes') for code syntax
   1761 ;; highlighting, while still using the Modus colors (and other
   1762 ;; mappings).
   1763 (setq modus-themes-common-palette-overrides
   1764       '((builtin magenta)
   1765         (comment yellow-faint)
   1766         (constant red-cooler)
   1767         (fnname magenta-warmer)
   1768         (keyword magenta-cooler)
   1769         (preprocessor green-warmer)
   1770         (docstring cyan-faint)
   1771         (string yellow-warmer)
   1772         (type cyan-warmer)
   1773         (variable blue-warmer)))
   1774 
   1775 ;; Mimic `ef-bio' theme (from my `ef-themes') for code syntax
   1776 ;; highlighting, while still using the Modus colors (and other
   1777 ;; mappings).
   1778 (setq modus-themes-common-palette-overrides
   1779       '((builtin green)
   1780         (comment yellow-faint)
   1781         (constant blue)
   1782         (fnname green-warmer)
   1783         (keyword green-cooler)
   1784         (preprocessor green)
   1785         (docstring green-faint)
   1786         (string magenta-cooler)
   1787         (type cyan-warmer)
   1788         (variable blue-warmer)))
   1789 
   1790 ;; Mimic `ef-trio-light' theme (from my `ef-themes') for code syntax
   1791 ;; highlighting, while still using the Modus colors (and other
   1792 ;; mappings).
   1793 (setq modus-themes-common-palette-overrides
   1794       '((builtin magenta-cooler)
   1795         (comment yellow-faint)
   1796         (constant magenta-warmer)
   1797         (fnname blue-warmer)
   1798         (keyword magenta)
   1799         (preprocessor red-cooler)
   1800         (docstring magenta-faint)
   1801         (string green-cooler)
   1802         (type cyan-cooler)
   1803         (variable cyan-warmer)))
   1804 #+end_src
   1805 
   1806 *** Make matching parenthesis more or less intense
   1807 :PROPERTIES:
   1808 :CUSTOM_ID: h:259cf8f5-48ec-4b13-8a69-5d6387094468
   1809 :END:
   1810 
   1811 This is one of our practical examples to override the semantic colors
   1812 of the Modus themes ([[#h:df1199d8-eaba-47db-805d-6b568a577bf3][Stylistic variants using palette overrides]]).  In
   1813 this code block we show how to change the background of matching
   1814 delimiters when ~show-paren-mode~ is enabled.  We also demonstrate how
   1815 to enable underlines for those highlights.
   1816 
   1817 #+begin_src emacs-lisp
   1818 ;; These overrides are common to all Modus themes.  We also provide
   1819 ;; theme-specific options, such as `modus-operandi-palette-overrides'.
   1820 ;;
   1821 ;; In general, the theme-specific overrides are better for overriding
   1822 ;; color values, such as redefining what `blue-faint' looks like.  The
   1823 ;; common overrides are best used for changes to semantic color
   1824 ;; mappings, as we show below.
   1825 
   1826 ;; Change the background to a shade of magenta
   1827 (setq modus-themes-common-palette-overrides
   1828       '((bg-paren-match bg-magenta-intense)))
   1829 
   1830 ;; Enable underlines by applying a color to them
   1831 (setq modus-themes-common-palette-overrides
   1832       '((bg-paren-match bg-magenta-intense)
   1833         (underline-paren-match fg-main)))
   1834 #+end_src
   1835 
   1836 *** Make box buttons more or less gray
   1837 :PROPERTIES:
   1838 :CUSTOM_ID: h:4f6b6ca3-f5bb-4830-8312-baa232305360
   1839 :END:
   1840 
   1841 This is one of our practical examples to override the semantic colors
   1842 of the Modus themes ([[#h:df1199d8-eaba-47db-805d-6b568a577bf3][Stylistic variants using palette overrides]]).  By
   1843 default, the boxed buttons that appear in {{{kbd(M-x customize)}}} and
   1844 related are distinct shades of gray.  The following set of overrides
   1845 removes the gray from the active buttons and amplifies it for the
   1846 inactive ones.
   1847 
   1848 #+begin_src emacs-lisp
   1849 ;; These overrides are common to all Modus themes.  We also provide
   1850 ;; theme-specific options, such as `modus-operandi-palette-overrides'.
   1851 ;;
   1852 ;; In general, the theme-specific overrides are better for overriding
   1853 ;; color values, such as redefining what `blue-faint' looks like.  The
   1854 ;; common overrides are best used for changes to semantic color
   1855 ;; mappings, as we show below.
   1856 
   1857 (setq modus-themes-common-palette-overrides
   1858       '((bg-button-active bg-main)
   1859         (fg-button-active fg-main)
   1860         (bg-button-inactive bg-inactive)
   1861         (fg-button-inactive "gray50")))
   1862 #+end_src
   1863 
   1864 *** Make TODO and DONE more or less intense
   1865 :PROPERTIES:
   1866 :CUSTOM_ID: h:b57bb50b-a863-4ea8-bb38-6de2275fa868
   1867 :END:
   1868 
   1869 This is one of our practical examples to override the semantic colors
   1870 of the Modus themes ([[#h:df1199d8-eaba-47db-805d-6b568a577bf3][Stylistic variants using palette overrides]]).
   1871 Here we show how to affect just the =TODO= and =DONE= keywords that we
   1872 encounter in Org buffers.  The idea is to make those pop out more or
   1873 to subdue them.
   1874 
   1875 [[#h:11297984-85ea-4678-abe9-a73aeab4676a][Make headings more or less colorful]].
   1876 
   1877 [[#h:bb5b396f-5532-4d52-ab13-149ca24854f1][Make inline code in prose use alternative styles]].
   1878 
   1879 #+begin_src emacs-lisp
   1880 ;; These overrides are common to all Modus themes.  We also provide
   1881 ;; theme-specific options, such as `modus-operandi-palette-overrides'.
   1882 ;;
   1883 ;; In general, the theme-specific overrides are better for overriding
   1884 ;; color values, such as redefining what `blue-faint' looks like.  The
   1885 ;; common overrides are best used for changes to semantic color
   1886 ;; mappings, as we show below.
   1887 
   1888 ;; Increase intensity
   1889 (setq modus-themes-common-palette-overrides
   1890       '((prose-done green-intense)
   1891         (prose-todo red-intense)))
   1892 
   1893 ;; Tone down intensity
   1894 (setq modus-themes-common-palette-overrides
   1895       '((prose-done green-faint)   ; OR replace `green-faint' with `olive'
   1896         (prose-todo red-faint)))   ; OR replace `red-faint' with `rust'
   1897 
   1898 ;; Keep TODO at its default (so no override for it), but make DONE
   1899 ;; gray.
   1900 (setq modus-themes-common-palette-overrides
   1901       '((prose-done fg-dim)))
   1902 #+end_src
   1903 
   1904 *** Make headings more or less colorful
   1905 :PROPERTIES:
   1906 :CUSTOM_ID: h:11297984-85ea-4678-abe9-a73aeab4676a
   1907 :END:
   1908 
   1909 This is one of our practical examples to override the semantic colors
   1910 of the Modus themes ([[#h:df1199d8-eaba-47db-805d-6b568a577bf3][Stylistic variants using palette overrides]]).
   1911 Here we show how to alter the looks of headings, such as in Org mode.
   1912 Using overrides here offers far more flexibility than what we could
   1913 achieve with previous versions of the themes: the user can mix and
   1914 match styles at will.
   1915 
   1916 [[#h:b57bb50b-a863-4ea8-bb38-6de2275fa868][Make TODO and DONE more intense]].
   1917 
   1918 #+begin_src emacs-lisp
   1919 ;; These overrides are common to all Modus themes.  We also provide
   1920 ;; theme-specific options, such as `modus-operandi-palette-overrides'.
   1921 ;;
   1922 ;; In general, the theme-specific overrides are better for overriding
   1923 ;; color values, such as redefining what `blue-faint' looks like.  The
   1924 ;; common overrides are best used for changes to semantic color
   1925 ;; mappings, as we show below.
   1926 
   1927 
   1928 ;; Apply more colorful foreground to some headings (headings 0-8).
   1929 ;; Level 0 is for Org #+title and related.
   1930 (setq modus-themes-common-palette-overrides
   1931       '((fg-heading-1 blue-warmer)
   1932         (fg-heading-2 yellow-cooler)
   1933         (fg-heading-3 cyan-cooler)))
   1934 
   1935 ;; Like the above, but with gradient colors
   1936 (setq modus-themes-common-palette-overrides
   1937       '((fg-heading-1 blue)
   1938         (fg-heading-2 cyan)
   1939         (fg-heading-3 green)))
   1940 
   1941 ;; Add color to level 1 heading, but use the main foreground for
   1942 ;; others
   1943 (setq modus-themes-common-palette-overrides
   1944       '((fg-heading-1 blue)
   1945         (fg-heading-2 fg-main)
   1946         (fg-heading-3 fg-main)))
   1947 
   1948 ;; Apply colorful foreground, background, and overline (headings 0-8)
   1949 (setq modus-themes-common-palette-overrides
   1950       '((fg-heading-1 blue-warmer)
   1951         (bg-heading-1 bg-blue-nuanced)
   1952         (overline-heading-1 blue)))
   1953 
   1954 ;; Apply gray scale foreground, background, and overline (headings 0-8)
   1955 (setq modus-themes-common-palette-overrides
   1956       '((fg-heading-1 fg-main)
   1957         (bg-heading-1 bg-dim)
   1958         (overline-heading-1 border)))
   1959 #+end_src
   1960 
   1961 *** Make Org agenda more or less colorful
   1962 :PROPERTIES:
   1963 :CUSTOM_ID: h:a5af0452-a50f-481d-bf60-d8143f98105f
   1964 :END:
   1965 
   1966 This is one of our practical examples to override the semantic colors
   1967 of the Modus themes ([[#h:df1199d8-eaba-47db-805d-6b568a577bf3][Stylistic variants using palette overrides]]).
   1968 Here we provide three distinct code blocks.  The first adds
   1969 alternative and more varied colors to the Org agenda (and related).
   1970 The second uses faint coloration.  The third makes the agenda use
   1971 various shades of blue.  Mix and match at will, while also combining
   1972 these styles with what we show in the other chapters with practical
   1973 stylistic variants.
   1974 
   1975 #+begin_src emacs-lisp
   1976 ;; These overrides are common to all Modus themes.  We also provide
   1977 ;; theme-specific options, such as `modus-operandi-palette-overrides'.
   1978 ;;
   1979 ;; In general, the theme-specific overrides are better for overriding
   1980 ;; color values, such as redefining what `blue-faint' looks like.  The
   1981 ;; common overrides are best used for changes to semantic color
   1982 ;; mappings, as we show below.
   1983 
   1984 ;; Make the Org agenda use alternative and varied colors.
   1985 (setq modus-themes-common-palette-overrides
   1986       '((date-common cyan)   ; default value (for timestamps and more)
   1987         (date-deadline red-warmer)
   1988         (date-event magenta-warmer)
   1989         (date-holiday blue) ; for M-x calendar
   1990         (date-now yellow-warmer)
   1991         (date-scheduled magenta-cooler)
   1992         (date-weekday cyan-cooler)
   1993         (date-weekend blue-faint)))
   1994 #+end_src
   1995 
   1996 An example with faint coloration:
   1997 
   1998 #+begin_src emacs-lisp
   1999 ;; Make the Org agenda use faint colors.
   2000 (setq modus-themes-common-palette-overrides
   2001       '((date-common cyan-faint) ; for timestamps and more
   2002         (date-deadline red-faint)
   2003         (date-event fg-alt) ; default
   2004         (date-holiday magenta) ; default (for M-x calendar)
   2005         (date-now fg-main) ; default
   2006         (date-scheduled yellow-faint)
   2007         (date-weekday fg-dim)
   2008         (date-weekend fg-dim)))
   2009 #+end_src
   2010 
   2011 A third example that makes the agenda more blue:
   2012 
   2013 #+begin_src emacs-lisp
   2014 ;; Make the Org agenda use more blue instead of yellow and red.
   2015 (setq modus-themes-common-palette-overrides
   2016       '((date-common cyan) ; default value (for timestamps and more)
   2017         (date-deadline blue-cooler)
   2018         (date-event blue-faint)
   2019         (date-holiday blue) ; for M-x calendar
   2020         (date-now blue-faint)
   2021         (date-scheduled blue)
   2022         (date-weekday fg-main)
   2023         (date-weekend fg-dim)))
   2024 #+end_src
   2025 
   2026 Yet another example that also affects =DONE= and =TODO= keywords:
   2027 
   2028 #+begin_src emacs-lisp
   2029 ;; Change dates to a set of more subtle combinations.  Deadlines are a
   2030 ;; shade of magenta, scheduled dates are a shade of green that
   2031 ;; complements that of the deadlines, weekday headings use the main
   2032 ;; foreground color while weekends are a shade of gray.  The DONE
   2033 ;; keyword is a faint blue-gray while TODO is yellow.
   2034 (setq modus-themes-common-palette-overrides
   2035       '((date-deadline magenta-warmer)
   2036         (date-scheduled green-cooler)
   2037         (date-weekday fg-main)
   2038         (date-event fg-dim)
   2039         (date-now blue)
   2040         (prose-done fg-alt)
   2041         (prose-todo yellow)))
   2042 #+end_src
   2043 
   2044 *** Make inline code in prose use alternative styles
   2045 :PROPERTIES:
   2046 :CUSTOM_ID: h:bb5b396f-5532-4d52-ab13-149ca24854f1
   2047 :END:
   2048 
   2049 This is one of our practical examples to override the semantic colors
   2050 of the Modus themes ([[#h:df1199d8-eaba-47db-805d-6b568a577bf3][Stylistic variants using palette overrides]]).  In
   2051 the following code block we show how to affect constructs such as
   2052 Org's verbatim, code, and macro entries.  We also provide mappings for
   2053 tables, property drawers, tags, and code block delimiters, though we
   2054 do not show every possible permutation.
   2055 
   2056 [[#h:b57bb50b-a863-4ea8-bb38-6de2275fa868][Make TODO and DONE more or less intense]].
   2057 
   2058 #+begin_src emacs-lisp
   2059 ;; These overrides are common to all Modus themes.  We also provide
   2060 ;; theme-specific options, such as `modus-operandi-palette-overrides'.
   2061 ;;
   2062 ;; In general, the theme-specific overrides are better for overriding
   2063 ;; color values, such as redefining what `blue-faint' looks like.  The
   2064 ;; common overrides are best used for changes to semantic color
   2065 ;; mappings, as we show below.
   2066 
   2067 
   2068 ;; These are all the mappings at their default values for didactic
   2069 ;; purposes
   2070 (setq modus-themes-common-palette-overrides
   2071       '((prose-block fg-dim)
   2072         (prose-code green-cooler)
   2073         (prose-done green)
   2074         (prose-macro magenta-cooler)
   2075         (prose-metadata fg-dim)
   2076         (prose-metadata-value fg-alt)
   2077         (prose-table fg-alt)
   2078         (prose-tag magenta-faint)
   2079         (prose-todo red)
   2080         (prose-verbatim magenta-warmer)))
   2081 
   2082 ;; Make code block delimiters use a shade of red, tone down verbatim,
   2083 ;; code, and macro, and amplify the style of property drawers
   2084 (setq modus-themes-common-palette-overrides
   2085       '((prose-block red-faint)
   2086         (prose-code fg-dim)
   2087         (prose-macro magenta-faint)
   2088         (prose-metadata cyan)
   2089         (prose-metadata-value green-warmer)
   2090         (prose-verbatim fg-dim)))
   2091 
   2092 ;; Like the above but with more color variety for the inline code
   2093 ;; elements
   2094 (setq modus-themes-common-palette-overrides
   2095       '((prose-block red-faint)
   2096         (prose-code blue-cooler)
   2097         (prose-macro yellow-warmer)
   2098         (prose-metadata cyan)
   2099         (prose-metadata-value green-warmer)
   2100         (prose-verbatim red-warmer)))
   2101 #+end_src
   2102 
   2103 *** Make mail citations and headers more or less colorful
   2104 :PROPERTIES:
   2105 :CUSTOM_ID: h:7da7a4ad-5d3a-4f11-9796-5a1abed0f0c4
   2106 :END:
   2107 
   2108 This is one of our practical examples to override the semantic colors
   2109 of the Modus themes ([[#h:df1199d8-eaba-47db-805d-6b568a577bf3][Stylistic variants using palette overrides]]).  In
   2110 this section we show how to change the coloration of email message
   2111 headers and citations.  Before we show the code, this is the anatomy
   2112 of a message:
   2113 
   2114 #+begin_example message
   2115 From: Protesilaos <info@protesilaos.com>
   2116 To: Modus-Themes Development <~protesilaos/modus-themes@lists.sr.ht>
   2117 Subject: Test subject
   2118 --- Headers above this line; message and citations below ---
   2119 This is some sample text
   2120 
   2121 > > Older quote
   2122 > Newer quote
   2123 #+end_example
   2124 
   2125 We thus have the following:
   2126 
   2127 #+begin_src emacs-lisp
   2128 ;; These overrides are common to all Modus themes.  We also provide
   2129 ;; theme-specific options, such as `modus-operandi-palette-overrides'.
   2130 ;;
   2131 ;; In general, the theme-specific overrides are better for overriding
   2132 ;; color values, such as redefining what `blue-faint' looks like.  The
   2133 ;; common overrides are best used for changes to semantic color
   2134 ;; mappings, as we show below.
   2135 
   2136 
   2137 ;; Reduce the intensity of mail citations and headers
   2138 (setq modus-themes-common-palette-overrides
   2139       '((mail-cite-0 cyan-faint)
   2140         (mail-cite-1 yellow-faint)
   2141         (mail-cite-2 green-faint)
   2142         (mail-cite-3 red-faint)
   2143         (mail-part olive)
   2144         (mail-recipient indigo)
   2145         (mail-subject maroon)
   2146         (mail-other slate)))
   2147 
   2148 ;; Make mail citations more intense; adjust the headers accordingly
   2149 (setq modus-themes-common-palette-overrides
   2150       '((mail-cite-0 blue)
   2151         (mail-cite-1 yellow)
   2152         (mail-cite-2 green)
   2153         (mail-cite-3 magenta)
   2154         (mail-part magenta-cooler)
   2155         (mail-recipient cyan)
   2156         (mail-subject red-warmer)
   2157         (mail-other cyan-cooler)))
   2158 
   2159 ;; Make all citations faint and neutral; make most headers green but
   2160 ;; use red for the subject lie so that it stands out
   2161 (setq modus-themes-common-palette-overrides
   2162       '((mail-cite-0 fg-dim)
   2163         (mail-cite-1 fg-alt)
   2164         (mail-cite-2 fg-dim)
   2165         (mail-cite-3 fg-alt)
   2166         (mail-part yellow-cooler)
   2167         (mail-recipient green-cooler)
   2168         (mail-subject red-cooler)
   2169         (mail-other green)))
   2170 #+end_src
   2171 
   2172 *** Make the region preserve text colors, plus other styles
   2173 :PROPERTIES:
   2174 :CUSTOM_ID: h:c8605d37-66e1-42aa-986e-d7514c3af6fe
   2175 :END:
   2176 
   2177 This is one of our practical examples to override the semantic colors
   2178 of the Modus themes ([[#h:df1199d8-eaba-47db-805d-6b568a577bf3][Stylistic variants using palette overrides]]).
   2179 Here we show how to make the region respect the underlying text colors
   2180 or how to make the background more/less intense while combining it
   2181 with an appropriate foreground value.
   2182 
   2183 [[#h:a5140c9c-18b2-45db-8021-38d0b5074116][Do not extend the region background]].
   2184 
   2185 #+begin_src emacs-lisp
   2186 ;; These overrides are common to all Modus themes.  We also provide
   2187 ;; theme-specific options, such as `modus-operandi-palette-overrides'.
   2188 ;;
   2189 ;; In general, the theme-specific overrides are better for overriding
   2190 ;; color values, such as redefining what `blue-faint' looks like.  The
   2191 ;; common overrides are best used for changes to semantic color
   2192 ;; mappings, as we show below.
   2193 
   2194 
   2195 ;; A background with no specific foreground (use foreground of
   2196 ;; underlying text)
   2197 (setq modus-themes-common-palette-overrides
   2198       '((bg-region bg-ochre) ; try to replace `bg-ochre' with `bg-lavender', `bg-sage'
   2199         (fg-region unspecified)))
   2200 
   2201 ;; Subtle gray with a prominent blue foreground
   2202 (setq modus-themes-common-palette-overrides
   2203       '((bg-region bg-dim)
   2204         (fg-region blue-cooler)))
   2205 
   2206 ;; Intense magenta background combined with the main foreground
   2207 (setq modus-themes-common-palette-overrides
   2208       '((bg-region bg-magenta-intense)
   2209         (fg-region fg-main)))
   2210 #+end_src
   2211 
   2212 *** Make mouse highlights more or less colorful
   2213 :PROPERTIES:
   2214 :CUSTOM_ID: h:b5cab69d-d7cb-451c-8ff9-1f545ceb6caf
   2215 :END:
   2216 
   2217 This is one of our practical examples to override the semantic colors
   2218 of the Modus themes ([[#h:df1199d8-eaba-47db-805d-6b568a577bf3][Stylistic variants using palette overrides]]).  In
   2219 the following code block we show how to affect the semantic color
   2220 mapping that covers mouse hover effects and related highlights:
   2221 
   2222 #+begin_src emacs-lisp
   2223 ;; These overrides are common to all Modus themes.  We also provide
   2224 ;; theme-specific options, such as `modus-operandi-palette-overrides'.
   2225 ;;
   2226 ;; In general, the theme-specific overrides are better for overriding
   2227 ;; color values, such as redefining what `blue-faint' looks like.  The
   2228 ;; common overrides are best used for changes to semantic color
   2229 ;; mappings, as we show below.
   2230 
   2231 
   2232 ;; Make the background an intense yellow
   2233 (setq modus-themes-common-palette-overrides
   2234       '((bg-hover bg-yellow-intense)))
   2235 
   2236 ;; Make the background subtle green
   2237 (setq modus-themes-common-palette-overrides
   2238       '((bg-hover bg-green-subtle)))
   2239 #+end_src
   2240 
   2241 *** Make language underlines less colorful
   2242 :PROPERTIES:
   2243 :CUSTOM_ID: h:03dbd5af-6bae-475e-85a2-cec189f69598
   2244 :END:
   2245 
   2246 This is one of our practical examples to override the semantic colors
   2247 of the Modus themes ([[#h:df1199d8-eaba-47db-805d-6b568a577bf3][Stylistic variants using palette overrides]]).
   2248 Here we show how to affect the color of the underlines that are used
   2249 by code linters and prose spell checkers.
   2250 
   2251 #+begin_src emacs-lisp
   2252 ;; These overrides are common to all Modus themes.  We also provide
   2253 ;; theme-specific options, such as `modus-operandi-palette-overrides'.
   2254 ;;
   2255 ;; In general, the theme-specific overrides are better for overriding
   2256 ;; color values, such as redefining what `blue-faint' looks like.  The
   2257 ;; common overrides are best used for changes to semantic color
   2258 ;; mappings, as we show below.
   2259 
   2260 
   2261 ;; Make the underlines less intense
   2262 (setq modus-themes-common-palette-overrides
   2263       '((underline-err red-faint)
   2264         (underline-warning yellow-faint)
   2265         (underline-note cyan-faint)))
   2266 
   2267 ;; Change the color-coding of the underlines
   2268 (setq modus-themes-common-palette-overrides
   2269       '((underline-err yellow-intense)
   2270         (underline-warning magenta-intense)
   2271         (underline-note green-intense)))
   2272 #+end_src
   2273 
   2274 *** Make line numbers use alternative styles
   2275 :PROPERTIES:
   2276 :CUSTOM_ID: h:b6466f51-cb58-4007-9ebe-53a27af655c7
   2277 :END:
   2278 
   2279 This is one of our practical examples to override the semantic colors
   2280 of the Modus themes ([[#h:df1199d8-eaba-47db-805d-6b568a577bf3][Stylistic variants using palette overrides]]).  In
   2281 this section we show how to affect the ~display-line-numbers-mode~.
   2282 
   2283 #+begin_src emacs-lisp
   2284 ;; These overrides are common to all Modus themes.  We also provide
   2285 ;; theme-specific options, such as `modus-operandi-palette-overrides'.
   2286 ;;
   2287 ;; In general, the theme-specific overrides are better for overriding
   2288 ;; color values, such as redefining what `blue-faint' looks like.  The
   2289 ;; common overrides are best used for changes to semantic color
   2290 ;; mappings, as we show below.
   2291 
   2292 
   2293 ;; Make line numbers less intense
   2294 (setq modus-themes-common-palette-overrides
   2295       '((fg-line-number-inactive "gray50")
   2296         (fg-line-number-active fg-main)
   2297         (bg-line-number-inactive unspecified)
   2298         (bg-line-number-active unspecified)))
   2299 
   2300 ;; Like the above, but use a shade of red for the current line number
   2301 (setq modus-themes-common-palette-overrides
   2302       '((fg-line-number-inactive "gray50")
   2303         (fg-line-number-active red-cooler)
   2304         (bg-line-number-inactive unspecified)
   2305         (bg-line-number-active unspecified)))
   2306 
   2307 ;; Make all numbers more intense, use a more pronounce gray
   2308 ;; background, and make the current line have a colored background
   2309 (setq modus-themes-common-palette-overrides
   2310       '((fg-line-number-inactive fg-main)
   2311         (fg-line-number-active fg-main)
   2312         (bg-line-number-inactive bg-inactive)
   2313         (bg-line-number-active bg-cyan-intense)))
   2314 #+end_src
   2315 
   2316 *** Make diffs use only a foreground
   2317 :PROPERTIES:
   2318 :CUSTOM_ID: h:b3761482-bcbf-4990-a41e-4866fb9dad15
   2319 :END:
   2320 
   2321 This is one of our practical examples to override the semantic colors
   2322 of the Modus themes ([[#h:df1199d8-eaba-47db-805d-6b568a577bf3][Stylistic variants using palette overrides]]).  In
   2323 this section we show how to change diff buffers (e.g. in ~magit~) to
   2324 only use color-coded text without any added background.  What we
   2325 basically do is to disable the applicable backgrounds and then
   2326 intensify the foregrounds.  Since the deuteranopia-optimized themes do
   2327 not use the red-green color coding, we make an extra set of
   2328 adjustments for them by overriding their palettes directly instead of
   2329 just using the "common" overrides.
   2330 
   2331 #+begin_src emacs-lisp
   2332 ;; Diffs with only foreground colors.  Word-wise ("refined") diffs
   2333 ;; have a gray background to draw attention to themselves.
   2334 (setq modus-themes-common-palette-overrides
   2335       '((bg-added           unspecified)
   2336         (bg-added-faint     unspecified)
   2337         (bg-added-refine    bg-inactive)
   2338         (fg-added           green)
   2339         (fg-added-intense   green-intense)
   2340 
   2341         (bg-changed         unspecified)
   2342         (bg-changed-faint   unspecified)
   2343         (bg-changed-refine  bg-inactive)
   2344         (fg-changed         yellow)
   2345         (fg-changed-intense yellow-intense)
   2346 
   2347         (bg-removed         unspecified)
   2348         (bg-removed-faint   unspecified)
   2349         (bg-removed-refine  bg-inactive)
   2350         (fg-removed         red)
   2351         (fg-removed-intense red-intense)
   2352 
   2353         (bg-diff-context    unspecified)))
   2354 
   2355 ;; Because deuteranopia cannot use the typical red-yellow-green
   2356 ;; combination, we need to arrange for a yellow-purple-blue sequence.
   2357 ;; Notice that the above covers the "common" overrides, so we do not
   2358 ;; need to reproduce the whole list of them.
   2359 (setq modus-operandi-deuteranopia-palette-overrides
   2360       '((fg-added           blue)
   2361         (fg-added-intense   blue-intense)
   2362 
   2363         (fg-changed         magenta-cooler)
   2364         (fg-changed-intense magenta-intense)
   2365 
   2366         (fg-removed         yellow-warmer)
   2367         (fg-removed-intense yellow-intense)))
   2368 
   2369 (setq modus-vivendi-deuteranopia-palette-overrides
   2370       '((fg-added           blue)
   2371         (fg-added-intense   blue-intense)
   2372 
   2373         (fg-changed         magenta-cooler)
   2374         (fg-changed-intense magenta-intense)
   2375 
   2376         (fg-removed         yellow)
   2377         (fg-removed-intense yellow-intense)))
   2378 #+end_src
   2379 
   2380 *** Make deuteranopia diffs red and blue instead of yellow and blue
   2381 :PROPERTIES:
   2382 :CUSTOM_ID: h:16389ea1-4cb6-4b18-9409-384324113541
   2383 :END:
   2384 
   2385 This is one of our practical examples to override the semantic colors
   2386 of the Modus themes ([[#h:df1199d8-eaba-47db-805d-6b568a577bf3][Stylistic variants using palette overrides]]).  In
   2387 this section we show how to implement a red+blue color coding for
   2388 diffs in the themes ~modus-operandi-deuteranopia~ and
   2389 ~modus-vivendi-deuteranopia~.  As those themes are optimized for users
   2390 with red-green color deficiency, they do not use the typical red+green
   2391 color coding for diffs, defaulting instead to yellow+blue which are
   2392 discernible.  Users with deuteranomaly or, generally, those who like a
   2393 different aesthetic, can use the following to make diffs use the
   2394 red+yellow+blue color coding for removed, changed, and added lines
   2395 respectively.  This is achieved by overriding the "changed" and
   2396 "removed" entries to use the colors of regular ~modus-operandi~ and
   2397 ~modus-vivendi~.
   2398 
   2399 #+begin_src emacs-lisp
   2400 (setq modus-operandi-deuteranopia-palette-overrides
   2401       '((bg-changed         "#ffdfa9")
   2402         (bg-changed-faint   "#ffefbf")
   2403         (bg-changed-refine  "#fac090")
   2404         (bg-changed-fringe  "#d7c20a")
   2405         (fg-changed         "#553d00")
   2406         (fg-changed-intense "#655000")
   2407 
   2408         (bg-removed         "#ffd8d5")
   2409         (bg-removed-faint   "#ffe9e9")
   2410         (bg-removed-refine  "#f3b5af")
   2411         (bg-removed-fringe  "#d84a4f")
   2412         (fg-removed         "#8f1313")
   2413         (fg-removed-intense "#aa2222")))
   2414 
   2415 (setq modus-vivendi-deuteranopia-palette-overrides
   2416       '((bg-changed         "#363300")
   2417         (bg-changed-faint   "#2a1f00")
   2418         (bg-changed-refine  "#4a4a00")
   2419         (bg-changed-fringe  "#8a7a00")
   2420         (fg-changed         "#efef80")
   2421         (fg-changed-intense "#c0b05f")
   2422 
   2423         (bg-removed         "#4f1119")
   2424         (bg-removed-faint   "#380a0f")
   2425         (bg-removed-refine  "#781a1f")
   2426         (bg-removed-fringe  "#b81a1f")
   2427         (fg-removed         "#ffbfbf")
   2428         (fg-removed-intense "#ff9095")))
   2429 #+end_src
   2430 
   2431 *** Make the themes look like what the maintainer uses
   2432 :PROPERTIES:
   2433 :CUSTOM_ID: h:aabcada6-810d-4eee-b34a-d2a9c301824d
   2434 :END:
   2435 
   2436 Based on what we have learnt from the previous sections of this
   2437 manual, here is what Protesilaos uses:
   2438 
   2439 #+begin_src emacs-lisp
   2440 ;; Always reload the theme for changes to take effect!
   2441 
   2442 (setq modus-themes-custom-auto-reload nil
   2443       modus-themes-to-toggle '(modus-operandi modus-vivendi)
   2444       modus-themes-mixed-fonts t
   2445       modus-themes-variable-pitch-ui nil
   2446       modus-themes-italic-constructs t
   2447       modus-themes-bold-constructs nil
   2448       modus-themes-org-blocks nil
   2449       modus-themes-completions '((t . (extrabold)))
   2450       modus-themes-prompts nil
   2451       modus-themes-headings
   2452       '((agenda-structure . (variable-pitch light 2.2))
   2453         (agenda-date . (variable-pitch regular 1.3))
   2454         (t . (regular 1.15))))
   2455 
   2456 (setq modus-themes-common-palette-overrides
   2457       '((cursor magenta-cooler)
   2458         ;; Make the fringe invisible.
   2459         (fringe unspecified)
   2460         ;; Make line numbers less intense and add a shade of cyan
   2461         ;; for the current line number.
   2462         (fg-line-number-inactive "gray50")
   2463         (fg-line-number-active cyan-cooler)
   2464         (bg-line-number-inactive unspecified)
   2465         (bg-line-number-active unspecified)
   2466         ;; Make the current line of `hl-line-mode' a fine shade of
   2467         ;; gray (though also see my `lin' package).
   2468         (bg-hl-line bg-dim)
   2469         ;; Make the region have a cyan-green background with no
   2470         ;; specific foreground (use foreground of underlying text).
   2471         ;; "bg-sage" refers to Salvia officinalis, else the common
   2472         ;; sage.
   2473         (bg-region bg-sage)
   2474         (fg-region unspecified)
   2475         ;; Make matching parentheses a shade of magenta.  It
   2476         ;; complements the region nicely.
   2477         (bg-paren-match bg-magenta-intense)
   2478         ;; Make email citations faint and neutral, reducing the
   2479         ;; default four colors to two; make mail headers cyan-blue.
   2480         (mail-cite-0 fg-dim)
   2481         (mail-cite-1 blue-faint)
   2482         (mail-cite-2 fg-dim)
   2483         (mail-cite-3 blue-faint)
   2484         (mail-part cyan-warmer)
   2485         (mail-recipient blue-warmer)
   2486         (mail-subject magenta-cooler)
   2487         (mail-other cyan-warmer)
   2488         ;; Change dates to a set of more subtle combinations.
   2489         (date-deadline magenta-cooler)
   2490         (date-scheduled magenta)
   2491         (date-weekday fg-main)
   2492         (date-event fg-dim)
   2493         (date-now blue-faint)
   2494         ;; Make tags (Org) less colorful and tables look the same as
   2495         ;; the default foreground.
   2496         (prose-done cyan-cooler)
   2497         (prose-tag fg-dim)
   2498         (prose-table fg-main)
   2499         ;; Make headings less colorful (though I never use deeply
   2500         ;; nested headings).
   2501         (fg-heading-2 blue-faint)
   2502         (fg-heading-3 magenta-faint)
   2503         (fg-heading-4 blue-faint)
   2504         (fg-heading-5 magenta-faint)
   2505         (fg-heading-6 blue-faint)
   2506         (fg-heading-7 magenta-faint)
   2507         (fg-heading-8 blue-faint)
   2508         ;; Make the active mode line a fine shade of lavender
   2509         ;; (purple) and tone down the gray of the inactive mode
   2510         ;; lines.
   2511         (bg-mode-line-active bg-lavender)
   2512         (border-mode-line-active bg-lavender)
   2513 
   2514         (bg-mode-line-inactive bg-dim)
   2515         (border-mode-line-inactive bg-inactive)
   2516         ;; Make the prompts a shade of magenta, to fit in nicely with
   2517         ;; the overall blue-cyan-purple style of the other overrides.
   2518         ;; Add a nuanced background as well.
   2519         (bg-prompt bg-magenta-nuanced)
   2520         (fg-prompt magenta-cooler)
   2521         ;; Tweak some more constructs for stylistic constistency.
   2522         (name blue-warmer)
   2523         (identifier magenta-faint)
   2524         (keybind magenta-cooler)
   2525         (accent-0 magenta-cooler)
   2526         (accent-1 cyan-cooler)
   2527         (accent-2 blue-warmer)
   2528         (accent-3 red-cooler)))
   2529 
   2530 ;; Make the active mode line have a pseudo 3D effect (this assumes
   2531 ;; you are using the default mode line and not an extra package).
   2532 (custom-set-faces
   2533  '(mode-line ((t :box (:style released-button)))))
   2534 #+end_src
   2535 
   2536 ** More accurate colors in terminal emulators
   2537 :PROPERTIES:
   2538 :CUSTOM_ID: h:fbb5e254-afd6-4313-bb05-93b3b4f67358
   2539 :END:
   2540 #+cindex: Color accuracy of terminal emulators
   2541 
   2542 [ This is based on partial information.  Please help verify and/or
   2543   expand these findings. ]
   2544 
   2545 The graphical version of Emacs can reproduce color values accurately.
   2546 Whereas things get more tricky when Emacs is used in a terminal
   2547 emulator, because the terminals' own capabilities determine the number
   2548 of colors that may be displayed: the Modus themes don't look as good in
   2549 that case.
   2550 
   2551 There is, however, a way to instruct supported terminal emulators to use
   2552 more accurate colors.  In a shell prompt type =toe -a | grep direct= to
   2553 get a list of relevant terminfo entries.  There should be items such as
   2554 =xterm-direct=, =alacritty-direct=, =kitty-direct=.  Once you find the one
   2555 that corresponds to your terminal, call Emacs with an environment
   2556 variable like =TERM=xterm-direct=.  Example that can be adapted to shell
   2557 aliases:
   2558 
   2559 : TERM=xterm-direct emacsclient -nw
   2560 
   2561 Another example that can be bound to a key:
   2562 
   2563 : TERM=xterm-direct uxterm -e emacsclient -nw
   2564 
   2565 ** Range of color with terminal emulators
   2566 :PROPERTIES:
   2567 :CUSTOM_ID: h:6b8211b0-d11b-4c00-9543-4685ec3b742f
   2568 :END:
   2569 #+cindex: Pure white and pure black in terminal emulators
   2570 
   2571 [ This is based on partial information.  Please help verify and/or
   2572   expand these findings. ]
   2573 
   2574 When Emacs runs in a non-windowed session its color reproduction
   2575 capacity is framed or determined by the underlying terminal emulator
   2576 ([[#h:fbb5e254-afd6-4313-bb05-93b3b4f67358][More accurate colors in terminal emulators]]).  Emacs cannot produce a
   2577 color that lies outside the range of what the terminal's color palette
   2578 renders possible.
   2579 
   2580 This is immediately noticeable when the terminal's first 16 codes do not
   2581 include a pure black value for the =termcol0= entry and a pure white for
   2582 =termcol15=.  Emacs cannot set the correct background (white for
   2583 ~modus-operandi~; black for ~modus-vivendi~) or foreground (inverse of
   2584 the background).  It thus falls back to the closest approximation, which
   2585 seldom is appropriate for the purposes of the Modus themes.
   2586 
   2587 In such a case, the user is expected to update their terminal's color
   2588 palette such as by adapting these resources ([[#h:f4d4b71b-2ca5-4c3d-b0b4-9bfd7aa7fb4d][Preview theme colors]]):
   2589 
   2590 #+begin_src emacs-lisp
   2591 ! Theme: modus-operandi
   2592 ! Description: XTerm port of modus-operandi (Modus themes for GNU Emacs)
   2593 ! Author: Protesilaos Stavrou, <https://protesilaos.com>
   2594 xterm*background: #ffffff
   2595 xterm*foreground: #000000
   2596 xterm*color0:     #000000
   2597 xterm*color1:     #a60000
   2598 xterm*color2:     #005e00
   2599 xterm*color3:     #813e00
   2600 xterm*color4:     #0031a9
   2601 xterm*color5:     #721045
   2602 xterm*color6:     #00538b
   2603 xterm*color7:     #bfbfbf
   2604 xterm*color8:     #595959
   2605 xterm*color9:     #972500
   2606 xterm*color10:    #315b00
   2607 xterm*color11:    #70480f
   2608 xterm*color12:    #2544bb
   2609 xterm*color13:    #5317ac
   2610 xterm*color14:    #005a5f
   2611 xterm*color15:    #ffffff
   2612 
   2613 ! Theme: modus-vivendi
   2614 ! Description: XTerm port of modus-vivendi (Modus themes for GNU Emacs)
   2615 ! Author: Protesilaos Stavrou, <https://protesilaos.com>
   2616 xterm*background: #000000
   2617 xterm*foreground: #ffffff
   2618 xterm*color0:     #000000
   2619 xterm*color1:     #ff8059
   2620 xterm*color2:     #44bc44
   2621 xterm*color3:     #d0bc00
   2622 xterm*color4:     #2fafff
   2623 xterm*color5:     #feacd0
   2624 xterm*color6:     #00d3d0
   2625 xterm*color7:     #bfbfbf
   2626 xterm*color8:     #595959
   2627 xterm*color9:     #ef8b50
   2628 xterm*color10:    #70b900
   2629 xterm*color11:    #c0c530
   2630 xterm*color12:    #79a8ff
   2631 xterm*color13:    #b6a0ff
   2632 xterm*color14:    #6ae4b9
   2633 xterm*color15:    #ffffff
   2634 #+end_src
   2635 
   2636 ** Preview theme colors
   2637 :properties:
   2638 :custom_id: h:f4d4b71b-2ca5-4c3d-b0b4-9bfd7aa7fb4d
   2639 :end:
   2640 #+cindex: Preview named colors or semantic color mappings
   2641 
   2642 #+findex: modus-themes-list-colors
   2643 The command ~modus-themes-list-colors~ uses minibuffer completion to
   2644 select an item from the Modus themes and then produces a buffer with
   2645 previews of its color palette entries.  The buffer has a naming scheme
   2646 that reflects the given choice, like =modus-operandi-list-colors= for
   2647 the ~modus-operandi~ theme.
   2648 
   2649 #+findex: modus-themes-list-colors-current
   2650 The command ~modus-themes-list-colors-current~ skips the minibuffer
   2651 selection process and just produces a preview for the current Modus
   2652 theme.
   2653 
   2654 When called with a prefix argument (=C-u= with the default key
   2655 bindings), these commands will show a preview of the palette's
   2656 semantic color mappings instead of the named colors.  In this context,
   2657 "named colors" are entries that associate a symbol to a string color
   2658 value, such as =(blue-warmer "#354fcf")=.  Whereas "semantic color
   2659 mappings" associate a named color to a symbol, like =(string
   2660 blue-warmer)=, thus making the theme render all string constructs in
   2661 the =blue-warmer= color value ([[#h:34c7a691-19bb-4037-8d2f-67a07edab150][Option for palette overrides]]).
   2662 
   2663 #+findex: modus-themes-preview-colors
   2664 #+findex: modus-themes-preview-colors-current
   2665 Aliases for those commands are ~modus-themes-preview-colors~ and
   2666 ~modus-themes-preview-colors-current~.
   2667 
   2668 Each row shows a foreground and background coloration using the
   2669 underlying value it references.  For example a line with =#a60000= (a
   2670 shade of red) will show red text followed by a stripe with that same
   2671 color as a backdrop.
   2672 
   2673 The name of the buffer describes the given Modus theme and what the
   2674 contents are, such as =*modus-operandi-list-colors*= for named colors
   2675 and ==*modus-operandi-list-mappings*= for the semantic color mappings.
   2676 
   2677 ** Per-theme customization settings
   2678 :properties:
   2679 :custom_id: h:a897b302-8e10-4a26-beab-3caaee1e1193
   2680 :end:
   2681 
   2682 If you prefer to maintain different customization options between the
   2683 two themes, it is best you write your own functions that first set those
   2684 options and then load the relevant theme.  The following code does
   2685 exactly that by simply differentiating the two themes on the choice of
   2686 bold constructs in code syntax (enabled for one, disabled for the
   2687 other).
   2688 
   2689 #+begin_src emacs-lisp
   2690 (defun my-demo-modus-operandi ()
   2691   (interactive)
   2692   (setq modus-themes-bold-constructs t) ; ENABLE bold
   2693   (modus-themes-load-theme 'modus-operandi))
   2694 
   2695 (defun my-demo-modus-vivendi ()
   2696   (interactive)
   2697   (setq modus-themes-bold-constructs nil) ; DISABLE bold
   2698   (modus-themes-load-theme 'modus-vivendi))
   2699 
   2700 (defun my-demo-modus-themes-toggle ()
   2701   (if (eq (car custom-enabled-themes) 'modus-operandi)
   2702       (my-demo-modus-vivendi)
   2703     (my-demo-modus-operandi)))
   2704 #+end_src
   2705 
   2706 Then assign ~my-demo-modus-themes-toggle~ to a key instead of the
   2707 equivalent the themes provide.
   2708 
   2709 For a more elaborate design, it is better to inspect the source code of
   2710 ~modus-themes-toggle~ and relevant functions.
   2711 
   2712 ** Get a single color from the palette
   2713 :PROPERTIES:
   2714 :CUSTOM_ID: h:1cc552c1-5f5f-4a56-ae78-7b69e8512c4e
   2715 :END:
   2716 
   2717 [[#h:51ba3547-b8c8-40d6-ba5a-4586477fd4ae][Use theme colors in code with modus-themes-with-colors]].
   2718 
   2719 #+findex: modus-themes-get-color-value
   2720 The fuction ~modus-themes-get-color-value~ can be called from Lisp to
   2721 return the value of a color from the active Modus theme palette.  It
   2722 takea a =COLOR= argument and an optional =OVERRIDES=.
   2723 
   2724 =COLOR= is a symbol that represents a named color entry in the
   2725 palette.
   2726 
   2727 [[#h:f4d4b71b-2ca5-4c3d-b0b4-9bfd7aa7fb4d][Preview theme colors]].
   2728 
   2729 If the value is the name of another color entry in the palette (so a
   2730 mapping), this function recurs until it finds the underlying color
   2731 value.
   2732 
   2733 With an optional =OVERRIDES= argument as a non-~nil~ value, it accounts
   2734 for palette overrides.  Else it reads only the default palette.
   2735 
   2736 [[#h:34c7a691-19bb-4037-8d2f-67a07edab150][Option for palette overrides]].
   2737 
   2738 With optional =THEME= as a symbol among ~modus-themes-items~ (alias
   2739 ~modus-themes-collection~), use the palette of that item.  Else use
   2740 the current Modus theme.
   2741 
   2742 If =COLOR= is not present in the palette, this function returns the
   2743 ~unspecified~ symbol, which is safe when used as a face attribute's
   2744 value.
   2745 
   2746 An example with ~modus-operandi~ to show how this function behaves
   2747 with/without overrides and when recursive mappings are introduced.
   2748 
   2749 #+begin_src emacs-lisp
   2750 ;; Here we show the recursion of palette mappings.  In general, it is
   2751 ;; better for the user to specify named colors to avoid possible
   2752 ;; confusion with their configuration, though those still work as
   2753 ;; expected.
   2754 (setq modus-themes-common-palette-overrides
   2755       '((cursor red)
   2756         (fg-mode-line-active cursor)
   2757         (border-mode-line-active fg-mode-line-active)))
   2758 
   2759 ;; Ignore the overrides and get the original value.
   2760 (modus-themes-get-color-value 'border-mode-line-active)
   2761 ;; => "#5a5a5a"
   2762 
   2763 ;; Read from the overrides and deal with any recursion to find the
   2764 ;; underlying value.
   2765 (modus-themes-get-color-value 'border-mode-line-active :overrides)
   2766 ;; => "#a60000"
   2767 #+end_src
   2768 
   2769 ** Use theme colors in code with modus-themes-with-colors
   2770 :properties:
   2771 :custom_id: h:51ba3547-b8c8-40d6-ba5a-4586477fd4ae
   2772 :end:
   2773 #+cindex: Use colors from the palette anywhere
   2774 
   2775 [[#h:1cc552c1-5f5f-4a56-ae78-7b69e8512c4e][Get a single color from the palette]].
   2776 
   2777 Note that users most probably do not need the following.  Just rely on
   2778 the comprehensive overrides we provide ([[#h:34c7a691-19bb-4037-8d2f-67a07edab150][Option for palette overrides]]).
   2779 
   2780 #+findex: modus-themes-with-colors
   2781 Advanced users may want to apply colors from the palette of the active
   2782 Modus theme in their custom code.  The ~modus-themes-with-colors~
   2783 macro supplies those to any form called inside of it.  For example:
   2784 
   2785 #+begin_src emacs-lisp
   2786 (modus-themes-with-colors
   2787   (list blue-warmer magenta-cooler fg-added warning variable fg-heading-4))
   2788 ;; => ("#354fcf" "#531ab6" "#005000" "#884900" "#005e8b" "#721045")
   2789 #+end_src
   2790 
   2791 The above return value is for ~modus-operandi~ when that is the active
   2792 theme.  Switching to another theme and evaluating this code anew will
   2793 give us the relevant results for that theme (remember that since
   2794 version 4, the Modus themes consist of six items ([[#h:f0f3dbcb-602d-40cf-b918-8f929c441baf][Overview]])).  The
   2795 same with ~modus-vivendi~ as the active theme:
   2796 
   2797 #+begin_src emacs-lisp
   2798 (modus-themes-with-colors
   2799   (list blue-warmer magenta-cooler fg-added warning variable fg-heading-4))
   2800 ;; => ("#79a8ff" "#b6a0ff" "#a0e0a0" "#fec43f" "#00d3d0" "#feacd0")
   2801 #+end_src
   2802 
   2803 The ~modus-themes-with-colors~ has access to the whole palette of the
   2804 active theme, meaning that it can instantiate both (i) named colors
   2805 like =blue-warmer= and (ii) semantic color mappings like =warning=.
   2806 We provide commands to inspect those ([[#h:f4d4b71b-2ca5-4c3d-b0b4-9bfd7aa7fb4d][Preview theme colors]]).
   2807 
   2808 Others sections in this manual show how to use the aforementioned
   2809 macro ([[#h:f4651d55-8c07-46aa-b52b-bed1e53463bb][Advanced customization]]).
   2810 
   2811 Because the ~modus-themes-with-colors~ will most likely be used to
   2812 customize faces, note that any function that calls it must be run at
   2813 startup after the theme loads.  The same function must also be
   2814 assigned to the ~modus-themes-after-load-theme-hook~ for its effects
   2815 to persist and be updated when switching between Modus themes (e.g. to
   2816 update the exact value of =blue-warmer= when toggling between
   2817 ~modus-operandi~ to ~modus-vivendi~.
   2818 
   2819 ** Do not extend the region background
   2820 :PROPERTIES:
   2821 :CUSTOM_ID: h:a5140c9c-18b2-45db-8021-38d0b5074116
   2822 :END:
   2823 
   2824 By the default, the background of the ~region~ face extends from the
   2825 end of the line to the edge of the window.  To limit it to the end of
   2826 the line, we need to override the face's =:extend= attribute.  Adding
   2827 this to the Emacs configuration file will suffice:
   2828 
   2829 #+begin_src emacs-lisp
   2830 ;; Do not extend `region' background past the end of the line.
   2831 (custom-set-faces
   2832  '(region ((t :extend nil))))
   2833 #+end_src
   2834 
   2835 [[#h:c8605d37-66e1-42aa-986e-d7514c3af6fe][Make the region preserve text colors, plus other styles]].
   2836 
   2837 ** Add padding to mode line
   2838 :PROPERTIES:
   2839 :CUSTOM_ID: h:5a0c58cc-f97f-429c-be08-927b9fbb0a9c
   2840 :END:
   2841 
   2842 Emacs faces do not have a concept of "padding" for the space between
   2843 the text and its box boundaries.  We can approximate the effect by
   2844 adding a =:box= attribute, making its border several pixels thick, and
   2845 using the mode line's background color for it.  This way the thick
   2846 border will not stand out and will appear as a continuation of the
   2847 mode line.
   2848 
   2849 [[#h:51ba3547-b8c8-40d6-ba5a-4586477fd4ae][Use theme colors in code with modus-themes-with-colors]].
   2850 
   2851 #+begin_src emacs-lisp
   2852 (defun my-modus-themes-custom-faces ()
   2853   (modus-themes-with-colors
   2854     (custom-set-faces
   2855      ;; Add "padding" to the mode lines
   2856      `(mode-line ((,c :box (:line-width 10 :color ,bg-mode-line-active))))
   2857      `(mode-line-inactive ((,c :box (:line-width 10 :color ,bg-mode-line-inactive)))))))
   2858 
   2859 (add-hook 'modus-themes-after-load-theme-hook #'my-modus-themes-custom-faces)
   2860 #+end_src
   2861 
   2862 The above has the effect of removing the border around the mode lines.
   2863 In older versions of the themes, we provided the option for a padded
   2864 mode line which could also have borders around it.  Those were not
   2865 real border, however, but an underline and an overline.  Adjusting the
   2866 above:
   2867 
   2868 #+begin_src emacs-lisp
   2869 (defun my-modus-themes-custom-faces ()
   2870   (modus-themes-with-colors
   2871     (custom-set-faces
   2872      ;; Add "padding" to the mode lines
   2873      `(mode-line ((,c :underline ,border-mode-line-active
   2874                       :overline ,border-mode-line-active
   2875                       :box (:line-width 10 :color ,bg-mode-line-active))))
   2876      `(mode-line-inactive ((,c :underline ,border-mode-line-inactive
   2877                                :overline ,border-mode-line-inactive
   2878                                :box (:line-width 10 :color ,bg-mode-line-inactive)))))))
   2879 
   2880 ;; ESSENTIAL to make the underline move to the bottom of the box:
   2881 (setq x-underline-at-descent-line t)
   2882 
   2883 (add-hook 'modus-themes-after-load-theme-hook #'my-modus-themes-custom-faces)
   2884 #+end_src
   2885 
   2886 The reason we no longer provide this option is because it depends on a
   2887 non-~nil~ value for ~x-underline-at-descent-line~.  That variable
   2888 affects ALL underlines, including those of links.  The effect is
   2889 intrusive and looks awkard in prose.
   2890 
   2891 As such, the Modus themes no longer provide that option but instead
   2892 offer this piece of documentation to make the user fully aware of the
   2893 state of affairs.
   2894 
   2895 ** Remap face with local value
   2896 :properties:
   2897 :custom_id: h:7a93cb6f-4eca-4d56-a85c-9dcd813d6b0f
   2898 :end:
   2899 #+cindex: Remapping faces
   2900 
   2901 There are cases where we need to change the buffer-local attributes of a
   2902 face.  This might be because we have our own minor mode that re-uses a
   2903 face for a particular purpose, such as a line selection tool that
   2904 activates ~hl-line-mode~, but we wish to keep it distinct from other
   2905 buffers.  This is where ~face-remap-add-relative~ can be applied and may
   2906 be combined with ~modus-themes-with-colors~ to deliver consistent results.
   2907 
   2908 [[#h:51ba3547-b8c8-40d6-ba5a-4586477fd4ae][Use theme colors in code with modus-themes-with-colors]].
   2909 
   2910 In this example we will write a simple interactive function that adjusts
   2911 the background color of the ~region~ face.  This is the sample code:
   2912 
   2913 #+begin_src emacs-lisp
   2914 (defvar my-rainbow-region-colors
   2915   (modus-themes-with-colors
   2916     `((red . ,bg-red-subtle)
   2917       (green . ,bg-green-subtle)
   2918       (yellow . ,bg-yellow-subtle)
   2919       (blue . ,bg-blue-subtle)
   2920       (magenta . ,bg-magenta-subtle)
   2921       (cyan . ,bg-cyan-subtle)))
   2922   "Sample list of color values for `my-rainbow-region'.")
   2923 
   2924 (defun my-rainbow-region (color)
   2925   "Remap buffer-local attribute of `region' using COLOR."
   2926   (interactive
   2927    (list
   2928     (completing-read "Pick a color: " my-rainbow-region-colors)))
   2929   (face-remap-add-relative
   2930    'region
   2931    `( :background ,(alist-get (intern color) my-rainbow-region-colors)
   2932       :foreground ,(face-attribute 'default :foreground))))
   2933 #+end_src
   2934 
   2935 When ~my-rainbow-region~ is called interactively, it prompts for a color
   2936 to use.  The list of candidates is drawn from the car of each
   2937 association in ~my-rainbow-region-colors~ (so "red", "green", etc.).
   2938 
   2939 To extend this principle, we may write wrapper functions that pass a
   2940 color directly.  Those can be useful in tandem with hooks.  Consider
   2941 this example:
   2942 
   2943 #+begin_src emacs-lisp
   2944 (defun my-rainbow-region-magenta ()
   2945   (my-rainbow-region 'magenta))
   2946 
   2947 (add-hook 'diff-mode-hook #'my-rainbow-region-magenta)
   2948 #+end_src
   2949 
   2950 Whenever we enter a ~diff-mode~ buffer, we now get a magenta-colored
   2951 region.
   2952 
   2953 Perhaps you may wish to generalize those findings in to a set of
   2954 functions that also accept an arbitrary face.  We shall leave the
   2955 experimentation up to you.
   2956 
   2957 ** Font configurations for Org and others
   2958 :properties:
   2959 :custom_id: h:defcf4fc-8fa8-4c29-b12e-7119582cc929
   2960 :end:
   2961 #+cindex: Font configurations
   2962 
   2963 The themes are designed to optionally cope well with mixed font
   2964 configurations.  This mostly concerns ~org-mode~ and ~markdown-mode~, though
   2965 expect to find it elsewhere like in ~Info-mode~.
   2966 
   2967 [[#h:115e6c23-ee35-4a16-8cef-e2fcbb08e28b][Option for font mixing]].
   2968 
   2969 In practice it means that the user can safely opt for a more
   2970 prose-friendly proportionately spaced typeface as their default, while
   2971 spacing-sensitive elements like tables and inline code always use a
   2972 monospaced font, by inheriting from the ~fixed-pitch~ face.
   2973 
   2974 Users can try the built-in {{{kbd(M-x variable-pitch-mode)}}} to see the
   2975 effect in action.
   2976 
   2977 To make everything use your desired font families, you need to configure
   2978 the ~variable-pitch~ (proportional spacing) and ~fixed-pitch~ (monospaced)
   2979 faces respectively.  It may also be convenient to set your main typeface
   2980 by configuring the ~default~ face the same way.
   2981 
   2982 [ The ~fontaine~ package on GNU ELPA (by Protesilaos) is designed to
   2983   handle this case. ]
   2984 
   2985 Put something like this in your initialization file (also consider
   2986 reading the doc string of ~set-face-attribute~):
   2987 
   2988 #+begin_src emacs-lisp
   2989 ;; Main typeface
   2990 (set-face-attribute 'default nil :family "DejaVu Sans Mono" :height 110)
   2991 
   2992 ;; Proportionately spaced typeface
   2993 (set-face-attribute 'variable-pitch nil :family "DejaVu Serif" :height 1.0)
   2994 
   2995 ;; Monospaced typeface
   2996 (set-face-attribute 'fixed-pitch nil :family "DejaVu Sans Mono" :height 1.5)
   2997 #+end_src
   2998 
   2999 Or employ the ~face-attribute~ function to read an existing value, such as
   3000 if you want to make ~fixed-pitch~ use the font family of the ~default~ face:
   3001 
   3002 #+begin_src emacs-lisp
   3003 (set-face-attribute 'fixed-pitch nil :family (face-attribute 'default :family))
   3004 #+end_src
   3005 
   3006 The next section shows how to make those work in a more elaborate setup
   3007 that is robust to changes between the Modus themes.
   3008 
   3009 [[#h:2793a224-2109-4f61-a106-721c57c01375][Configure bold and italic faces]].
   3010 
   3011 Note the differences in the ~:height~ property.  The ~default~ face must
   3012 specify an absolute value, which is the point size × 10.  So if you want
   3013 to use a font at point size =11=, you set the height to =110=.[fn:: ~:height~
   3014 values do not need to be rounded to multiples of ten: the likes of =115=
   3015 are perfectly valid—some typefaces will change to account for those
   3016 finer increments.]  Whereas every other face must either not specify a
   3017 height or have a value that is relative to the default, represented as a
   3018 floating point.  If you use an integer, then that means an absolute
   3019 height.  This is of paramount importance: it ensures that all fonts can
   3020 scale gracefully when using something like the ~text-scale-adjust~ command
   3021 which only operates on the base font size (i.e. the ~default~ face's
   3022 absolute height).
   3023 
   3024 [[#h:e6c5451f-6763-4be7-8fdb-b4706a422a4c][Note for EWW and Elfeed fonts]].
   3025 
   3026 ** Configure bold and italic faces
   3027 :properties:
   3028 :custom_id: h:2793a224-2109-4f61-a106-721c57c01375
   3029 :end:
   3030 #+cindex: Bold and italic fonts
   3031 
   3032 The Modus themes do not hardcode a ~:weight~ or ~:slant~ attribute in the
   3033 thousands of faces they cover.  Instead, they configure the generic
   3034 faces called ~bold~ and ~italic~ to use the appropriate styles and then
   3035 instruct all relevant faces that require emphasis to inherit from them.
   3036 
   3037 This practically means that users can change the particularities of what
   3038 it means for a construct to be bold/italic, by tweaking the ~bold~ and
   3039 ~italic~ faces.  Cases where that can be useful include:
   3040 
   3041 + The default typeface does not have a variant with slanted glyphs
   3042   (e.g. Fira Mono/Code as of this writing on 2021-07-07), so the user
   3043   wants to add another family for the italics, such as Hack.
   3044 
   3045 + The typeface of choice provides a multitude of weights and the user
   3046   prefers the light one by default.  To prevent the bold weight from
   3047   being too heavy compared to the light one, they opt to make ~bold~ use a
   3048   semibold weight.
   3049 
   3050 + The typeface distinguishes between oblique and italic forms by
   3051   providing different font variants (the former are just slanted
   3052   versions of the upright forms, while the latter have distinguishing
   3053   features as well).  In this case, the user wants to specify the font
   3054   that applies to the ~italic~ face.
   3055 
   3056 To achieve those effects, one must first be sure that the fonts they use
   3057 have support for those features.  It then is a matter of following the
   3058 instructions for all typeface tweaks.
   3059 
   3060 [[#h:defcf4fc-8fa8-4c29-b12e-7119582cc929][Font configurations for Org and others]].
   3061 
   3062 In this example, we set the default font family to Fira Code, while we
   3063 choose to render italics in the Hack typeface (obviously you need to
   3064 pick fonts that work well together):
   3065 
   3066 #+begin_src emacs-lisp
   3067 (set-face-attribute 'default nil :family "Fira Code" :height 110)
   3068 (set-face-attribute 'italic nil :family "Hack")
   3069 #+end_src
   3070 
   3071 And here we play with different weights, using Source Code Pro:
   3072 
   3073 #+begin_src emacs-lisp
   3074 (set-face-attribute 'default nil :family "Source Code Pro" :height 110 :weight 'light)
   3075 (set-face-attribute 'bold nil :weight 'semibold)
   3076 #+end_src
   3077 
   3078 To reset the font family, one can use this:
   3079 
   3080 #+begin_src emacs-lisp
   3081 (set-face-attribute 'italic nil :family 'unspecified)
   3082 #+end_src
   3083 
   3084 To ensure that the effects persist after switching between the Modus
   3085 themes (such as with {{{kbd(M-x modus-themes-toggle)}}}), the user needs to
   3086 write their configurations to a function and pass it to the
   3087 ~modus-themes-after-load-theme-hook~.  This is necessary because themes
   3088 set the styles of faces upon activation, overriding prior values where
   3089 conflicts occur between the previous and the current states (otherwise
   3090 changing themes would not be possible).
   3091 
   3092 [[#h:86f6906b-f090-46cc-9816-1fe8aeb38776][A theme-agnostic hook for theme loading]].
   3093 
   3094 This is a minimal setup to preserve font configurations across theme
   3095 load phases.  For a more permanent setup, it is better to rely on the
   3096 ~custom-set-faces~ function: ~set-face-attribute~ works just fine, though it
   3097 probably is better suited for quick previews or for smaller scale
   3098 operations (~custom-set-faces~ follows the format used in the source code
   3099 of the themes, which can make it easier to redefine faces in bulk).
   3100 
   3101 #+begin_src emacs-lisp
   3102 ;; our generic function
   3103 (defun my-modes-themes-bold-italic-faces ()
   3104   (set-face-attribute 'default nil :family "Source Code Pro" :height 110)
   3105   (set-face-attribute 'bold nil :weight 'semibold))
   3106 
   3107 ;; or use this if you configure a lot of face and attributes and
   3108 ;; especially if you plan to use `modus-themes-with-colors', as shown
   3109 ;; elsewhere in the manual
   3110 (defun my-modes-themes-bold-italic-faces ()
   3111   (custom-set-faces
   3112    '(default ((t :family "Source Code Pro" :height 110)))
   3113    '(bold ((t :weight semibold)))))
   3114 
   3115 ;; and here is the hook
   3116 (add-hook 'modus-themes-after-load-theme-hook #'my-modes-themes-bold-italic-faces)
   3117 #+end_src
   3118 
   3119 [[#h:51ba3547-b8c8-40d6-ba5a-4586477fd4ae][Use theme colors in code with modus-themes-with-colors]].
   3120 
   3121 ** Custom Org todo keyword and priority faces
   3122 :properties:
   3123 :custom_id: h:89f0678d-c5c3-4a57-a526-668b2bb2d7ad
   3124 :end:
   3125 #+cindex: Org custom todo faces
   3126 
   3127 Users of ~org-mode~ have the option to configure various keywords and
   3128 priority cookies to better match their workflow.  User options are
   3129 ~org-todo-keyword-faces~ and ~org-priority-faces~.
   3130 
   3131 As those are meant to be custom faces, it is futile to have the themes
   3132 guess what each user wants to use, which keywords to target, and so on.
   3133 Instead, we can provide guidelines on how to customize things to one's
   3134 liking with the intent of retaining the overall aesthetic of the themes.
   3135 
   3136 Please bear in mind that the end result of those is not controlled by
   3137 the active Modus theme but by how Org maps faces to its constructs.
   3138 Editing those while ~org-mode~ is active requires re-initialization of the
   3139 mode with {{{kbd(M-x org-mode-restart)}}} for changes to take effect.
   3140 
   3141 Let us assume you wish to visually differentiate your keywords.  You
   3142 have something like this:
   3143 
   3144 #+begin_src emacs-lisp
   3145 (setq org-todo-keywords
   3146       '((sequence "TODO(t)" "|" "DONE(D)" "CANCEL(C)")
   3147         (sequence "MEET(m)" "|" "MET(M)")
   3148         (sequence "STUDY(s)" "|" "STUDIED(S)")
   3149         (sequence "WRITE(w)" "|" "WROTE(W)")))
   3150 #+end_src
   3151 
   3152 You could then use a variant of the following to inherit from a face
   3153 that uses the styles you want and also to preserve the attributes
   3154 applied by the ~org-todo~ face (in case there is a difference between
   3155 the two):
   3156 
   3157 #+begin_src emacs-lisp
   3158 (setq org-todo-keyword-faces
   3159       '(("MEET" . (:inherit (bold org-todo)))
   3160         ("STUDY" . (:inherit (warning org-todo)))
   3161         ("WRITE" . (:inherit (shadow org-todo)))))
   3162 #+end_src
   3163 
   3164 This will refashion the keywords you specify, while letting the other
   3165 items in ~org-todo-keywords~ use their original styles, which are
   3166 defined in the ~org-todo~ and ~org-done~ faces.
   3167 
   3168 If you want back the defaults, try specifying just the ~org-todo~ face:
   3169 
   3170 #+begin_src emacs-lisp
   3171 (setq org-todo-keyword-faces
   3172       '(("MEET" . org-todo)
   3173         ("STUDY" . org-todo)
   3174         ("WRITE" . org-todo)))
   3175 #+end_src
   3176 
   3177 Or set ~org-todo-keyword-faces~ to ~nil~.
   3178 
   3179 When you inherit from multiple faces, you need to do it the way it is
   3180 shown further above.  The order is significant: the first entry is
   3181 applied on top of the second, overriding any attributes that are
   3182 explicitly set for both of them: any attribute that is not specified
   3183 is not overridden, so, for example, if ~org-todo~ has a background and
   3184 a foreground, while ~font-lock-type-face~ only has a foreground, the
   3185 merged face will include the background of the former and the
   3186 foreground of the latter.  If you do not want to blend multiple faces,
   3187 you only specify one by name without parentheses or an =:inherit=
   3188 keyword.  A pattern of =keyword . face= will suffice.
   3189 
   3190 Both approaches can be used simultaneously, as illustrated in this
   3191 configuration of the priority cookies:
   3192 
   3193 #+begin_src emacs-lisp
   3194 (setq org-priority-faces
   3195       '((?A . (:inherit (bold org-priority)))
   3196         (?B . org-priority)
   3197         (?C . (:inherit (shadow org-priority)))))
   3198 #+end_src
   3199 
   3200 To find all the faces that are loaded in your current Emacs session, use
   3201 {{{kbd(M-x list-faces-display)}}}.  Try {{{kbd(M-x describe-variable)}}} as well and
   3202 then specify the name of each of those Org variables demonstrated above.
   3203 Their documentation strings will offer you further guidance.
   3204 
   3205 Recall that the themes let you retrieve a color from their palette.  Do
   3206 it if you plan to control face attributes.
   3207 
   3208 [[#h:02e25930-e71a-493d-828a-8907fc80f874][Check color combinations]].
   3209 
   3210 ** Custom Org emphasis faces
   3211 :properties:
   3212 :custom_id: h:26026302-47f4-4471-9004-9665470e7029
   3213 :end:
   3214 #+cindex: Org custom emphasis faces
   3215 
   3216 Org provides the user option ~org-emphasis-alist~ which associates a
   3217 character with a face, list of faces, or face attributes.  The default
   3218 specification of that variable looks like this:
   3219 
   3220 #+begin_src emacs-lisp
   3221 (setq org-emphasis-alist
   3222       '(("*" bold)
   3223         ("/" italic)
   3224         ("_" underline)
   3225         ("=" org-verbatim verbatim)
   3226         ("~" org-code verbatim)
   3227         ("+" (:strike-through t))))
   3228 #+end_src
   3229 
   3230 With the exception of ~org-verbatim~ and ~org-code~ faces, everything else
   3231 uses the corresponding type of emphasis: a bold typographic weight, or
   3232 italicised, underlined, and struck through text.
   3233 
   3234 The best way for users to add some extra attributes, such as a
   3235 foreground color, is to define their own faces and assign them to the
   3236 given emphasis marker/character.
   3237 
   3238 This is a custom face that extends the standard ~bold~ face with a red
   3239 foreground value (so it colorises the text in addition to the bold
   3240 weight):
   3241 
   3242 #+begin_src emacs-lisp
   3243 (defface my-org-emphasis-bold
   3244   '((default :inherit bold)
   3245     (((class color) (min-colors 88) (background light))
   3246      :foreground "#a60000")
   3247     (((class color) (min-colors 88) (background dark))
   3248      :foreground "#ff8059"))
   3249   "My bold emphasis for Org.")
   3250 #+end_src
   3251 
   3252 This face definition reads as follows:
   3253 
   3254 + Always inherit the ~bold~ face ([[#h:2793a224-2109-4f61-a106-721c57c01375][Configure bold and italic faces]]).
   3255 + For versions of Emacs that support at least 88 colors (graphical
   3256   Emacs, for example) and use a light background, apply the =#a60000=
   3257   value.
   3258 + For the same kind of Emacs that has a dark background use the =#ff8059=
   3259   color instead.
   3260 
   3261 Same principle for how to extend ~italic~ and ~underline~ with, for example,
   3262 green and yellow hues, respectively:
   3263 
   3264 #+begin_src emacs-lisp
   3265 (defface my-org-emphasis-italic
   3266   '((default :inherit italic)
   3267     (((class color) (min-colors 88) (background light))
   3268      :foreground "#005e00")
   3269     (((class color) (min-colors 88) (background dark))
   3270      :foreground "#44bc44"))
   3271   "My italic emphasis for Org.")
   3272 
   3273 (defface my-org-emphasis-underline
   3274   '((default :inherit underline)
   3275     (((class color) (min-colors 88) (background light))
   3276      :foreground "#813e00")
   3277     (((class color) (min-colors 88) (background dark))
   3278      :foreground "#d0bc00"))
   3279   "My underline emphasis for Org.")
   3280 #+end_src
   3281 
   3282 In the case of a strike-through effect, we have no generic face to
   3283 inherit from, so we can write it as follows to also change the
   3284 foreground to a more subtle gray:
   3285 
   3286 #+begin_src emacs-lisp
   3287 (defface my-org-emphasis-strike-through
   3288   '((default :strike-through t)
   3289     (((class color) (min-colors 88) (background light))
   3290      :foreground "#505050")
   3291     (((class color) (min-colors 88) (background dark))
   3292      :foreground "#a8a8a8"))
   3293   "My strike-through emphasis for Org.")
   3294 #+end_src
   3295 
   3296 Or we can just change the color of the line that strikes through the
   3297 text to, for example, a shade of red:
   3298 
   3299 #+begin_src emacs-lisp
   3300 (defface my-org-emphasis-strike-through
   3301   '((((class color) (min-colors 88) (background light))
   3302      :strike-through "#972500")
   3303     (((class color) (min-colors 88) (background dark))
   3304      :strike-through "#ef8b50"))
   3305   "My strike-through emphasis for Org.")
   3306 #+end_src
   3307 
   3308 It is possible to combine those effects:
   3309 
   3310 #+begin_src emacs-lisp
   3311 (defface my-org-emphasis-strike-through
   3312   '((((class color) (min-colors 88) (background light))
   3313      :strike-through "#972500" :foreground "#505050")
   3314     (((class color) (min-colors 88) (background dark))
   3315      :strike-through "#ef8b50" :foreground "#a8a8a8"))
   3316   "My strike-through emphasis for Org.")
   3317 #+end_src
   3318 
   3319 One may inspect the variables ~modus-themes-operandi-colors~ and
   3320 ~modus-themes-vivendi-colors~ for possible color values.  Or call the
   3321 command ~modus-themes-list-colors~ to show a buffer that previews each
   3322 entry in the palette.
   3323 
   3324 [[#h:f4d4b71b-2ca5-4c3d-b0b4-9bfd7aa7fb4d][Visualize the active Modus theme's palette]].
   3325 
   3326 Once we have defined the faces we need, we must update the
   3327 ~org-emphasis-alist~.  Given that ~org-verbatim~ and ~org-code~ are already
   3328 styled by the themes, it probably is best not to edit them:
   3329 
   3330 #+begin_src emacs-lisp
   3331 (setq org-emphasis-alist
   3332       '(("*" my-org-emphasis-bold)
   3333         ("/" my-org-emphasis-italic)
   3334         ("_" my-org-emphasis-underline)
   3335         ("=" org-verbatim verbatim)
   3336         ("~" org-code verbatim)
   3337         ("+" my-org-emphasis-strike-through)))
   3338 #+end_src
   3339 
   3340 That's it!  For changes to take effect in already visited Org files,
   3341 invoke {{{kbd(M-x org-mode-restart)}}}.
   3342 
   3343 ** Update Org block delimiter fontification
   3344 :properties:
   3345 :custom_id: h:f44cc6e3-b0f1-4a5e-8a90-9e48fa557b50
   3346 :end:
   3347 
   3348 As noted in the section about ~modus-themes-org-blocks~, Org contains a
   3349 variable that determines whether the block's begin and end lines are
   3350 extended to the edge of the window ([[#h:b7e328c0-3034-4db7-9cdf-d5ba12081ca2][Option for org-mode block styles]]).
   3351 The variable is ~org-fontify-whole-block-delimiter-line~.
   3352 
   3353 Users who change the style of Org blocks from time to time may prefer to
   3354 automatically update delimiter line fontification, such as with the
   3355 following setup:
   3356 
   3357 #+begin_src emacs-lisp
   3358 (defun my-modus-themes-org-fontify-block-delimiter-lines ()
   3359   "Match `org-fontify-whole-block-delimiter-line' to theme style.
   3360 Run this function at the post theme load phase, such as with the
   3361 `modus-themes-after-load-theme-hook'."
   3362   (if (eq modus-themes-org-blocks 'gray-background)
   3363       (setq org-fontify-whole-block-delimiter-line t)
   3364     (setq org-fontify-whole-block-delimiter-line nil)))
   3365 
   3366 (add-hook 'modus-themes-after-load-theme-hook
   3367           #'my-modus-themes-org-fontify-block-delimiter-lines)
   3368 #+end_src
   3369 
   3370 Then {{{kbd(M-x org-mode-restart)}}} for changes to take effect, though manual
   3371 intervention can be circumvented by tweaking the function thus:
   3372 
   3373 #+begin_src emacs-lisp
   3374 (defun my-modus-themes-org-fontify-block-delimiter-lines ()
   3375   "Match `org-fontify-whole-block-delimiter-line' to theme style.
   3376 Run this function at the post theme load phase, such as with the
   3377 `modus-themes-after-load-theme-hook'."
   3378   (if (eq modus-themes-org-blocks 'gray-background)
   3379       (setq org-fontify-whole-block-delimiter-line t)
   3380     (setq org-fontify-whole-block-delimiter-line nil))
   3381   (when (derived-mode-p 'org-mode)
   3382     (font-lock-flush)))
   3383 #+end_src
   3384 
   3385 ** Measure color contrast
   3386 :properties:
   3387 :custom_id: h:02e25930-e71a-493d-828a-8907fc80f874
   3388 :end:
   3389 #+findex: modus-themes-contrast
   3390 #+findex: modus-themes-wcag-formula
   3391 #+cindex: Color contrast
   3392 
   3393 The themes provide the functions ~modus-themes-wcag-formula~ and
   3394 ~modus-themes-contrast~.  The former is a direct implementation of the
   3395 WCAG formula: <https://www.w3.org/TR/WCAG20-TECHS/G18.html>.  It
   3396 calculates the relative luminance of a color value that is expressed in
   3397 hexadecimal RGB notation.  While the latter function is just a
   3398 convenient wrapper for comparing the relative luminance between two
   3399 colors.
   3400 
   3401 In practice, one needs to work only with ~modus-themes-contrast~.  It
   3402 accepts two color values and returns their contrast ratio.  Values range
   3403 from 1 to 21 (lowest to highest).  The themes are designed to always be
   3404 equal or higher than 7 for each combination of background and foreground
   3405 that they use (this is the WCAG AAA standard---the most demanding of its
   3406 kind).
   3407 
   3408 A couple of examples (rounded numbers):
   3409 
   3410 #+begin_src emacs-lisp
   3411 ;; Pure white with pure green
   3412 (modus-themes-contrast "#ffffff" "#00ff00")
   3413 ;; => 1.37
   3414 ;; That is an outright inaccessible combo
   3415 
   3416 ;; Pure black with pure green
   3417 (modus-themes-contrast "#000000" "#00ff00")
   3418 ;; => 15.3
   3419 ;; That is a highly accessible combo
   3420 #+end_src
   3421 
   3422 It does not matter which color value comes first.  The ratio is always
   3423 the same.
   3424 
   3425 If one does not wish to read all the decimal points, it is possible to
   3426 try something like this:
   3427 
   3428 #+begin_src emacs-lisp
   3429 (format "%0.2f" (modus-themes-contrast "#000000" "#00ff00"))
   3430 #+end_src
   3431 
   3432 While it is fine to perform such calculations on a case-by-case basis,
   3433 it is preferable to implement formulas and tables for more demanding
   3434 tasks.  Such instruments are provided by ~org-mode~ or ~orgtbl-mode~, both
   3435 of which are built into Emacs.  Below is such a table that derives the
   3436 contrast ratio of all colors in the first column (pure red, green, blue)
   3437 relative to the color specified in the first row of the second column
   3438 (pure white) and rounds the results:
   3439 
   3440 #+begin_example
   3441 |         | #ffffff |
   3442 |---------+---------|
   3443 | #ff0000 |    4.00 |
   3444 | #00ff00 |    1.37 |
   3445 | #0000ff |    8.59 |
   3446 #+tblfm: $2='(modus-themes-contrast $1 @1$2);%0.2f
   3447 #+end_example
   3448 
   3449 To measure color contrast one needs to start from a known value.  This
   3450 typically is the background.  The Modus themes define an expanded
   3451 palette in large part because certain colors are only meant to be used
   3452 in combination with some others.  Consult the source code for the
   3453 minutia and relevant commentary.
   3454 
   3455 Such knowledge may prove valuable while attempting to customize the
   3456 theme's color palette.
   3457 
   3458 ** Load theme depending on time of day
   3459 :properties:
   3460 :custom_id: h:1d1ef4b4-8600-4a09-993c-6de3af0ddd26
   3461 :end:
   3462 
   3463 While we do provide ~modus-themes-toggle~ to manually switch between the
   3464 themes, users may also set up their system to perform such a task
   3465 automatically at sunrise and sunset.
   3466 
   3467 This can be accomplished by specifying the coordinates of one's
   3468 location using the built-in {{{file(solar.el)}}} and then configuring
   3469 the ~circadian~ package:
   3470 
   3471 #+begin_src emacs-lisp
   3472 (use-package solar                      ; built-in
   3473   :config
   3474   (setq calendar-latitude 35.17
   3475         calendar-longitude 33.36))
   3476 
   3477 (use-package circadian                  ; you need to install this
   3478   :ensure t
   3479   :after solar
   3480   :config
   3481   (setq circadian-themes '((:sunrise . modus-operandi)
   3482                            (:sunset  . modus-vivendi)))
   3483   (circadian-setup))
   3484 #+end_src
   3485 
   3486 ** Backdrop for pdf-tools
   3487 :properties:
   3488 :custom_id: h:ff69dfe1-29c0-447a-915c-b5ff7c5509cd
   3489 :end:
   3490 #+cindex: Remapping pdf-tools backdrop
   3491 
   3492 Most PDF files use a white background for their page, making it
   3493 impossible to discern the file's boundaries in the buffer while using
   3494 the Modus Operandi theme.  To introduce a distinction between the
   3495 buffer's backdrop and the PDF page's background, the former must be
   3496 rendered as some shade of gray.  Ideally, ~pdf-tools~ would provide a face
   3497 that the themes could support directly, though this does not seem to be
   3498 the case for the time being.  We must thus employ the face remapping
   3499 technique that is documented elsewhere in this document to change the
   3500 buffer-local value of the ~default~ face.
   3501 
   3502 [[#h:7a93cb6f-4eca-4d56-a85c-9dcd813d6b0f][Remap face with local value]].
   3503 
   3504 To remap the buffer's backdrop, we start with a function like this one:
   3505 
   3506 #+begin_src emacs-lisp
   3507 (defun my-pdf-tools-backdrop ()
   3508   (modus-themes-with-colors
   3509     (face-remap-add-relative
   3510      'default
   3511      `(:background ,bg-dim))))
   3512 
   3513 (add-hook 'pdf-tools-enabled-hook #'my-pdf-tools-backdrop)
   3514 #+end_src
   3515 
   3516 The idea is to assign that function to a hook that gets called when
   3517 ~pdf-tools~ renders the document: ~pdf-tools-enabled-hook~.  This is enough
   3518 when you only use one theme.  However it has the downside of setting the
   3519 background color value only at render time.  In other words, the face
   3520 remapping function does not get evaluated anew whenever the theme
   3521 changes, such as upon invoking {{{kbd(M-x modus-themes-toggle)}}}.
   3522 
   3523 To have our face remapping adapt gracefully while switching between the
   3524 Modus themes, we need to also account for the current theme and control
   3525 the activation of ~pdf-view-midnight-minor-mode~.  To which end we arrive
   3526 at something like the following, which builds on the above example:
   3527 
   3528 #+begin_src emacs-lisp
   3529 (defun my-pdf-tools-backdrop ()
   3530   (modus-themes-with-colors
   3531     (face-remap-add-relative
   3532      'default
   3533      `(:background ,bg-dim))))
   3534 
   3535 (defun my-pdf-tools-midnight-mode-toggle ()
   3536   (when (derived-mode-p 'pdf-view-mode)
   3537     (if (eq (car custom-enabled-themes) 'modus-vivendi)
   3538         (pdf-view-midnight-minor-mode 1)
   3539       (pdf-view-midnight-minor-mode -1))
   3540     (my-pdf-tools-backdrop)))
   3541 
   3542 (defun my-pdf-tools-themes-toggle ()
   3543   (mapc
   3544    (lambda (buf)
   3545      (with-current-buffer buf
   3546        (my-pdf-tools-midnight-mode-toggle)))
   3547    (buffer-list)))
   3548 
   3549 (add-hook 'pdf-tools-enabled-hook #'my-pdf-tools-midnight-mode-toggle)
   3550 (add-hook 'modus-themes-after-load-theme-hook #'my-pdf-tools-themes-toggle)
   3551 #+end_src
   3552 
   3553 With those in place, PDFs have a distinct backdrop for their page, while
   3554 buffers with major-mode as ~pdf-view-mode~ automatically switches to dark
   3555 mode when ~modus-themes-toggle~ is called.
   3556 
   3557 ** Toggle themes without reloading them
   3558 :properties:
   3559 :custom_id: h:b40aca50-a3b2-4c43-be58-2c26fcd14237
   3560 :end:
   3561 #+cindex: Switch themes without load-theme
   3562 
   3563 Users who have a stable setup and who only ever need to toggle between
   3564 the themes without triggering a full reload, are better off defining
   3565 their own command which calls ~enable-theme~ instead of ~load-theme~:
   3566 
   3567 #+begin_src emacs-lisp
   3568 (defun my-modus-themes-toggle ()
   3569   "Toggle between `modus-operandi' and `modus-vivendi' themes.
   3570 This uses `enable-theme' instead of the standard method of
   3571 `load-theme'.  The technicalities are covered in the Modus themes
   3572 manual."
   3573   (interactive)
   3574   (pcase (modus-themes--current-theme)
   3575     ('modus-operandi (progn (enable-theme 'modus-vivendi)
   3576                             (disable-theme 'modus-operandi)))
   3577     ('modus-vivendi (progn (enable-theme 'modus-operandi)
   3578                             (disable-theme 'modus-vivendi)))
   3579     (_ (error "No Modus theme is loaded; evaluate `modus-themes-load-themes' first"))))
   3580 #+end_src
   3581 
   3582 [[#h:e68560b3-7fb0-42bc-a151-e015948f8a35][Differences between loading and enabling]].
   3583 
   3584 Recall that ~modus-themes-toggle~ uses ~load-theme~.
   3585 
   3586 ** A theme-agnostic hook for theme loading
   3587 :properties:
   3588 :custom_id: h:86f6906b-f090-46cc-9816-1fe8aeb38776
   3589 :end:
   3590 
   3591 The themes are designed with the intent to be useful to Emacs users of
   3592 varying skill levels, from beginners to experts.  This means that we try
   3593 to make things easier by not expecting anyone reading this document to
   3594 be proficient in Emacs Lisp or programming in general.
   3595 
   3596 Such a case is with the use of ~modus-themes-after-load-theme-hook~,
   3597 which runs after the ~modus-themes-load-theme~ function (used by the
   3598 command ~modus-themes-toggle~).  We recommend using that hook for
   3599 advanced customizations, because (1) we know for sure that it is
   3600 available once the themes are loaded, and (2) anyone consulting this
   3601 manual, especially the sections on enabling and loading the themes,
   3602 will be in a good position to benefit from that hook.
   3603 
   3604 Advanced users who have a need to switch between the Modus themes and
   3605 other items will find that such a hook does not meet their requirements:
   3606 it only works with the Modus themes and only with the aforementioned
   3607 functions.
   3608 
   3609 A theme-agnostic setup can be configured thus:
   3610 
   3611 #+begin_src emacs-lisp
   3612 (defvar after-enable-theme-hook nil
   3613    "Normal hook run after enabling a theme.")
   3614 
   3615 (defun run-after-enable-theme-hook (&rest _args)
   3616    "Run `after-enable-theme-hook'."
   3617    (run-hooks 'after-enable-theme-hook))
   3618 
   3619 (advice-add 'enable-theme :after #'run-after-enable-theme-hook)
   3620 #+end_src
   3621 
   3622 This creates the ~after-enable-theme-hook~ and makes it run after each
   3623 call to ~enable-theme~, which means that it will work for all themes and
   3624 also has the benefit that it does not depend on functions such as
   3625 ~modus-themes-toggle~ and the others mentioned above.  ~enable-theme~ is
   3626 called internally by ~load-theme~, so the hook works everywhere.
   3627 
   3628 The downside of the theme-agnostic hook is that any functions added to
   3629 it will likely not be able to benefit from macro calls that read the
   3630 active theme, such as ~modus-themes-with-colors~.  Not all Emacs
   3631 themes have the same capabilities.
   3632 
   3633 In this document, we cover ~modus-themes-after-load-theme-hook~ though
   3634 the user can replace it with ~after-enable-theme-hook~ should they
   3635 need to (provided they understand the implications).
   3636 
   3637 ** Use more spacious margins or padding in Emacs frames
   3638 :PROPERTIES:
   3639 :CUSTOM_ID: h:43bcb5d0-e25f-470f-828c-662cee9e21f1
   3640 :END:
   3641 
   3642 [ UPDATE 2023-06-25: Instead of following these instructions, you can
   3643   simply install my ~spacious-padding~ package from GNU ELPA.  It
   3644   implements the padding and provides relevant user options. ]
   3645 
   3646 By default, Emacs frames try to maximize the number of characters that
   3647 fit in the current visible portion of the buffer.  Users may prefer to
   3648 have some extra padding instead.  This can make Emacs frames look more
   3649 pleasant, but also make it easier to identify the currently active
   3650 window.
   3651 
   3652 The way to implement such padding is two-fold:
   3653 
   3654 1. In the =early-init.el= file instruct Emacs to use a higher value
   3655    for the ~internal-border-width~ of all frames, as well as for the
   3656    ~right-divider-width~.  The former concerns the outer boundaries of
   3657    Emacs frames, while the latter pertains to dividers between Emacs
   3658    windows.
   3659 
   3660 2. Make the relevant faces invisible by changing the value of their
   3661    relevant attributes to that of the current theme's main background.
   3662 
   3663 The parameters of Emacs frames are specified in the variables
   3664 ~initial-frame-alist~ and ~default-frame-alist~.  The "initial frame"
   3665 refers to the first frame that appears on Emacs startup.  The
   3666 "default" refers to the fallback values that apply to all other frames
   3667 that Emacs creates (unless those are explicitly overridden by a
   3668 bespoke ~make-frame~ call).
   3669 
   3670 In detail, first we use the same values for the two frame alist variables:
   3671 
   3672 #+begin_src emacs-lisp
   3673 ;; This must go in the early-init.el so that it applies to the initial
   3674 ;; frame.
   3675 (dolist (var '(default-frame-alist initial-frame-alist))
   3676   (add-to-list var '(right-divider-width . 20))
   3677   (add-to-list var '(internal-border-width . 20)))
   3678 #+end_src
   3679 
   3680 What the ~dolist~ does is to call ~add-to-list~ for the two variables
   3681 we specify there.  This economizes on typing.
   3682 
   3683 Then we define a function that makes the relevant faces invisible.
   3684 The reason we do this with a function is so we can hook it to the
   3685 "post load" phase of a theme, thus applying the new background value
   3686 (otherwise you keep the old background, which likely means that the
   3687 faces will no longer be invisible).
   3688 
   3689 #+begin_src emacs-lisp
   3690 (defun my-modus-themes-invisible-dividers ()
   3691   "Make window dividers invisible.
   3692 Add this to the `modus-themes-post-load-hook'."
   3693   (let ((bg (face-background 'default)))
   3694     (custom-set-faces
   3695      `(fringe ((t :background ,bg :foreground ,bg)))
   3696      `(window-divider ((t :background ,bg :foreground ,bg)))
   3697      `(window-divider-first-pixel ((t :background ,bg :foreground ,bg)))
   3698      `(window-divider-last-pixel ((t :background ,bg :foreground ,bg))))))
   3699 
   3700 (add-hook 'modus-themes-post-load-hook #'my-modus-themes-invisible-dividers)
   3701 #+end_src
   3702 
   3703 The above will work only for themes that belong to the Modus family.
   3704 For users of Emacs version 29 or higher, there exists a theme-agnostic
   3705 hook that takes a function with one argument---that of the theme---and
   3706 calls in the the "post enable" phase of theme loading.  Here is the
   3707 above snippet, with the necessary tweaks:
   3708 
   3709 #+begin_src emacs-lisp
   3710 (defun my-modus-themes-invisible-dividers (_theme)
   3711   "Make window dividers for THEME invisible."
   3712   (let ((bg (face-background 'default)))
   3713     (custom-set-faces
   3714      `(fringe ((t :background ,bg :foreground ,bg)))
   3715      `(window-divider ((t :background ,bg :foreground ,bg)))
   3716      `(window-divider-first-pixel ((t :background ,bg :foreground ,bg)))
   3717      `(window-divider-last-pixel ((t :background ,bg :foreground ,bg))))))
   3718 
   3719 (add-hook 'enable-theme-functions #'my-modus-themes-invisible-dividers)
   3720 #+end_src
   3721 
   3722 Users of older versions of Emacs can read the entry herein about
   3723 defining their own theme-agnostic hook ([[#h:86f6906b-f090-46cc-9816-1fe8aeb38776][A theme-agnostic hook for theme loading]]).
   3724 
   3725 ** Custom hl-todo colors
   3726 :PROPERTIES:
   3727 :CUSTOM_ID: h:2ef83a21-2f0a-441e-9634-473feb940743
   3728 :END:
   3729 
   3730 The ~hl-todo~ package provides the user option
   3731 ~hl-todo-keyword-faces~: it specifies a pair of keyword and
   3732 corresponding color value.  The Modus themes configure that option in
   3733 the interest of legibility.  While this works for our purposes, users
   3734 may still prefer to apply their custom values, in which case the
   3735 following approach is necessary:
   3736 
   3737 #+begin_src emacs-lisp
   3738 (defun my-modus-themes-hl-todo-faces ()
   3739   (setq hl-todo-keyword-faces '(("TODO" . "#ff0000")
   3740                                 ("HACK" . "#ffff00")
   3741                                 ("XXX" . "#00ffff")
   3742                                 ("NOTE" . "#ff00ff"))))
   3743 
   3744 (add-hook 'modus-themes-after-load-theme-hook #'my-modus-themes-hl-todo-faces)
   3745 #+end_src
   3746 
   3747 Or include a ~let~ form, if needed:
   3748 
   3749 #+begin_src emacs-lisp
   3750 (defun my-modus-themes-hl-todo-faces ()
   3751   (let ((red "#ff0000")
   3752         (blue "#0000ff"))
   3753     (setq hl-todo-keyword-faces `(("TODO" . ,blue)
   3754                                   ("HACK" . ,red)
   3755                                   ("XXX" . ,red)
   3756                                   ("NOTE" . ,blue)))))
   3757 
   3758 (add-hook 'modus-themes-after-load-theme-hook #'my-modus-themes-hl-todo-faces)
   3759 #+end_src
   3760 
   3761 Normally, we do not touch user options, though this is an exception:
   3762 otherwise the defaults are not always legible.
   3763 
   3764 ** Add support for solaire-mode
   3765 :PROPERTIES:
   3766 :CUSTOM_ID: h:439c9e46-52e2-46be-b1dc-85841dd99671
   3767 :END:
   3768 
   3769 The ~solaire-mode~ package dims the background of what it considers
   3770 ancillary "UI" buffers, such as the minibuffer and Dired buffers.  The
   3771 Modus themes used to support Solaire on the premise that the user was
   3772 (i) opting in to it, (ii) understood why certain buffers were more gray,
   3773 and (iii) knew what other adjustments had to be made to prevent broken
   3774 visuals (e.g. the default style of the ~modus-themes-completions~ uses a
   3775 subtle gray background for the selection, which with Solaire becomes
   3776 practically invisible).
   3777 
   3778 However, the assumption that users opt in to this feature does not
   3779 always hold true.  There are cases where it is enabled by defaultsuch as
   3780 in the popular Doom Emacs configuration.  Thus, the unsuspecting user
   3781 who loads ~modus-operandi~ or ~modus-vivendi~ without the requisite
   3782 customizations is getting a sub-par experience; an experience that we
   3783 did not intend and cannot genuinely fix.
   3784 
   3785 Because the Modus themes are meant to work everywhere, we cannot make an
   3786 exception for Doom Emacs and/or Solaire users.  Furthermore, we shall
   3787 not introduce hacks, such as by adding a check in all relevant faces to
   3788 be adjusted based on Solaire or whatever other package.  Hacks of this
   3789 sort are unsustainable and penalize the entire userbase.  Besides, the
   3790 themes are built into Emacs and we must keep their standard high.
   3791 
   3792 The fundamental constraint with Solaire is that Emacs does not have a
   3793 real distinction between "content" and "UI" buffers.  For themes to work
   3794 with Solaire, they need to be designed around that package.  Such is an
   3795 arrangement that compromises on our accessibility standards and/or
   3796 hinders our efforts to provide the best possible experience while using
   3797 the Modus themes.
   3798 
   3799 As such, ~solaire-mode~ is not---and will not be---supported by the
   3800 Modus themes (or any other of my themes, for that matter).  Users who
   3801 want it must style the faces manually.  Below is some sample code, based
   3802 on what we cover at length elsewhere in this manual:
   3803 
   3804 [[#h:f4651d55-8c07-46aa-b52b-bed1e53463bb][Advanced customization]].
   3805 
   3806 [[#h:51ba3547-b8c8-40d6-ba5a-4586477fd4ae][Use theme colors in code with modus-themes-with-colors]].
   3807 
   3808 #+begin_src emacs-lisp
   3809 (defun my-modus-themes-custom-faces ()
   3810   (modus-themes-with-colors
   3811     (custom-set-faces
   3812      `(solaire-default-face ((,c :inherit default :background ,bg-dim :foreground ,fg-dim)))
   3813      `(solaire-line-number-face ((,c :inherit solaire-default-face :foreground ,fg-unfocused)))
   3814      `(solaire-hl-line-face ((,c :background ,bg-active)))
   3815      `(solaire-org-hide-face ((,c :background ,bg-dim :foreground ,bg-dim))))))
   3816 
   3817 (add-hook 'modus-themes-after-load-theme-hook #'my-modus-themes-custom-faces)
   3818 #+end_src
   3819 
   3820 As always, re-load the theme for changes to take effect.
   3821 
   3822 * Face coverage
   3823 :properties:
   3824 :custom_id: h:a9c8f29d-7f72-4b54-b74b-ddefe15d6a19
   3825 :end:
   3826 
   3827 The Modus themes try to provide as close to full face coverage as
   3828 possible.  This is necessary to ensure a consistently accessible reading
   3829 experience across all available interfaces.
   3830 
   3831 ** Full support for packages or face groups
   3832 :properties:
   3833 :alt_title: Supported packages
   3834 :description: Full list of covered face groups
   3835 :custom_id: h:60ed4275-60d6-49f8-9287-9a64e54bea0e
   3836 :end:
   3837 #+cindex: Explicitly supported packages
   3838 
   3839 This list will always be updated to reflect the current state of the
   3840 project.  The idea is to offer an overview of the known status of all
   3841 affected face groups.  The items with an appended asterisk =*= tend to
   3842 have lots of extensions, so the "full support" may not be 100% true…
   3843 
   3844 + ace-window
   3845 + agda2-mode
   3846 + all-the-icons
   3847 + all-the-icons-dired
   3848 + all-the-icons-ibuffer
   3849 + annotate
   3850 + ansi-color
   3851 + anzu
   3852 + auctex and TeX
   3853 + auto-dim-other-buffers
   3854 + avy
   3855 + bbdb
   3856 + binder
   3857 + breadcrumb
   3858 + bongo
   3859 + boon
   3860 + bookmark
   3861 + calendar and diary
   3862 + centaur-tabs
   3863 + change-log and log-view (such as ~vc-print-log~, ~vc-print-root-log~)
   3864 + chart
   3865 + cider
   3866 + circe
   3867 + citar
   3868 + clojure-mode
   3869 + column-enforce-mode
   3870 + company-mode*
   3871 + compilation-mode
   3872 + completions
   3873 + consult
   3874 + corfu
   3875 + corfu-candidate-overlay
   3876 + corfu-quick
   3877 + counsel*
   3878 + cperl-mode
   3879 + crontab-mode
   3880 + csv-mode
   3881 + ctrlf
   3882 + custom (what you get with {{{kbd(M-x customize)}}})
   3883 + dashboard
   3884 + deadgrep
   3885 + deft
   3886 + devdocs
   3887 + dictionary
   3888 + diff-hl
   3889 + diff-mode
   3890 + dim-autoload
   3891 + dired
   3892 + dired-async
   3893 + dired-git
   3894 + dired-git-info
   3895 + dired-narrow
   3896 + dired-subtree
   3897 + diredfl
   3898 + disk-usage
   3899 + display-fill-column-indicator-mode
   3900 + doom-modeline
   3901 + ediff
   3902 + ein (Emacs IPython Notebook)
   3903 + eglot
   3904 + el-search
   3905 + eldoc-box
   3906 + elfeed
   3907 + elfeed-score
   3908 + elpher
   3909 + embark
   3910 + ement
   3911 + emms
   3912 + enh-ruby-mode (enhanced-ruby-mode)
   3913 + epa
   3914 + erc
   3915 + ert
   3916 + erts-mode
   3917 + eshell
   3918 + eshell-fringe-status
   3919 + evil* (evil-mode)
   3920 + eww
   3921 + exwm
   3922 + eyebrowse
   3923 + flycheck
   3924 + flycheck-color-mode-line
   3925 + flycheck-indicator
   3926 + flymake
   3927 + flyspell
   3928 + flx
   3929 + focus
   3930 + fold-this
   3931 + font-lock (generic syntax highlighting)
   3932 + geiser
   3933 + git-commit
   3934 + git-gutter (and variants)
   3935 + git-rebase
   3936 + git-timemachine
   3937 + gnus
   3938 + gotest
   3939 + golden-ratio-scroll-screen
   3940 + helpful
   3941 + highlight-numbers
   3942 + highlight-parentheses ([[#h:24bab397-dcb2-421d-aa6e-ec5bd622b913][Note on highlight-parentheses.el]])
   3943 + highlight-thing
   3944 + hl-fill-column
   3945 + hl-line-mode
   3946 + hl-todo
   3947 + hydra
   3948 + ibuffer
   3949 + icomplete
   3950 + ido-mode
   3951 + iedit
   3952 + iflipb
   3953 + image-dired
   3954 + imenu-list
   3955 + indium
   3956 + info
   3957 + info+ (info-plus)
   3958 + info-colors
   3959 + ioccur
   3960 + isearch, occur, etc.
   3961 + ivy*
   3962 + ivy-posframe
   3963 + japanese-holidays
   3964 + jira (org-jira)
   3965 + jit-spell
   3966 + jinx
   3967 + journalctl-mode
   3968 + js2-mode
   3969 + julia
   3970 + kaocha-runner
   3971 + keycast
   3972 + ledger-mode
   3973 + leerzeichen
   3974 + line numbers (~display-line-numbers-mode~ and global variant)
   3975 + magit
   3976 + make-mode
   3977 + man
   3978 + marginalia
   3979 + markdown-mode
   3980 + markup-faces (~adoc-mode~)
   3981 + messages
   3982 + minimap
   3983 + mode-line
   3984 + mood-line
   3985 + mpdel
   3986 + mu4e
   3987 + multiple-cursors
   3988 + nerd-icons
   3989 + nerd-icons-completion
   3990 + nerd-icons-dired
   3991 + nerd-icons-ibuffer
   3992 + neotree
   3993 + notmuch
   3994 + num3-mode
   3995 + nxml-mode
   3996 + olivetti
   3997 + orderless
   3998 + org*
   3999 + org-journal
   4000 + org-noter
   4001 + org-pomodoro
   4002 + org-recur
   4003 + org-roam
   4004 + org-superstar
   4005 + org-table-sticky-header
   4006 + org-tree-slide
   4007 + origami
   4008 + outline-mode
   4009 + outline-minor-faces
   4010 + package (what you get with {{{kbd(M-x list-packages)}}})
   4011 + page-break-lines
   4012 + pandoc-mode
   4013 + paren-face
   4014 + pass
   4015 + pdf-tools
   4016 + persp-mode
   4017 + perspective
   4018 + popup
   4019 + powerline
   4020 + prism ([[#h:a94272e0-99da-4149-9e80-11a7e67a2cf2][Note for prism.el]])
   4021 + prescient
   4022 + proced
   4023 + prodigy
   4024 + pulse
   4025 + pyim
   4026 + quick-peek
   4027 + rainbow-delimiters
   4028 + rcirc
   4029 + rcirc-color
   4030 + recursion-indicator
   4031 + regexp-builder (also known as ~re-builder~)
   4032 + rg (rg.el)
   4033 + ripgrep
   4034 + rmail
   4035 + rst-mode
   4036 + ruler-mode
   4037 + sesman
   4038 + shell-script-mode
   4039 + shortdoc
   4040 + show-paren-mode
   4041 + shr
   4042 + side-notes
   4043 + sieve-mode
   4044 + skewer-mode
   4045 + slime (slbd)
   4046 + sly
   4047 + smart-mode-line
   4048 + smerge
   4049 + speedbar
   4050 + spell-fu
   4051 + stripes
   4052 + suggest
   4053 + switch-window
   4054 + swiper
   4055 + symbol-overlay
   4056 + syslog-mode
   4057 + tab-bar-mode
   4058 + tab-line-mode
   4059 + table (built-in {{{file(table.el)}}})
   4060 + telega
   4061 + terraform-mode
   4062 + term
   4063 + textsec
   4064 + transient (pop-up windows such as Magit's)
   4065 + trashed
   4066 + tree-sitter
   4067 + tty-menu
   4068 + tuareg
   4069 + typescript
   4070 + undo-tree
   4071 + vc ({{{file(vc-dir.el)}}}, {{{file(vc-hooks.el)}}})
   4072 + vertico
   4073 + vertico-quick
   4074 + vimish-fold
   4075 + visible-mark
   4076 + visual-regexp
   4077 + vterm
   4078 + vundo
   4079 + wcheck-mode
   4080 + web-mode
   4081 + wgrep
   4082 + which-function-mode
   4083 + which-key
   4084 + whitespace-mode
   4085 + window-divider-mode
   4086 + writegood-mode
   4087 + woman
   4088 + xah-elisp-mode
   4089 + xterm-color (and ansi-colors)
   4090 + yaml-mode
   4091 + yasnippet
   4092 
   4093 Plus many other miscellaneous faces that are provided by Emacs.
   4094 
   4095 ** Indirectly covered packages
   4096 :properties:
   4097 :custom_id: h:2cb359c7-3a84-4262-bab3-dcdc1d0034d7
   4098 :end:
   4099 #+cindex: Implicitly supported packages
   4100 
   4101 These do not require any extra styles because they are configured to
   4102 inherit from some basic faces or their dependencies which are directly
   4103 supported by the themes.
   4104 
   4105 + ag
   4106 + apropos
   4107 + apt-sources-list
   4108 + bbdb
   4109 + bm
   4110 + breakpoint (provided by the built-in {{{file(gdb-mi.el)}}} library)
   4111 + buffer-expose
   4112 + bufler
   4113 + counsel-notmuch
   4114 + counsel-org-capture-string
   4115 + css-mode
   4116 + dashboard (emacs-dashboard)
   4117 + define-word
   4118 + denote
   4119 + disk-usage
   4120 + dtache
   4121 + dynamic-ruler
   4122 + easy-kill
   4123 + ebdb
   4124 + edit-indirect
   4125 + egerrit
   4126 + elfeed-summary
   4127 + evil-owl
   4128 + flyspell-correct
   4129 + fortran-mode
   4130 + freeze-it
   4131 + forge
   4132 + git-walktree
   4133 + goggles
   4134 + highlight-defined
   4135 + highlight-escape-sequences (~hes-mode~)
   4136 + icomplete-vertical
   4137 + i3wm-config-mode
   4138 + lin
   4139 + minibuffer-line
   4140 + no-emoji
   4141 + org-remark
   4142 + parrot
   4143 + perl-mode
   4144 + php-mode
   4145 + pulsar
   4146 + rjsx-mode
   4147 + side-hustle
   4148 + spell-fu
   4149 + swift-mode
   4150 + tab-bar-echo-area
   4151 + tide
   4152 + undo-hl
   4153 + vdiff
   4154 + vertico-indexed
   4155 + vertico-mouse
   4156 + xref
   4157 
   4158 * Notes on individual packages
   4159 :properties:
   4160 :custom_id: h:4c4d901a-84d7-4f20-bd99-0808c2b06eba
   4161 :end:
   4162 
   4163 This section covers information that may be of interest to users of
   4164 individual packages.
   4165 
   4166 ** Note on calendar.el weekday and weekend colors
   4167 :properties:
   4168 :custom_id: h:b2db46fb-32f4-44fd-8e11-d2b261cf51ae
   4169 :end:
   4170 
   4171 By default, the {{{kbd(M-x calendar)}}} interface differentiates weekdays from
   4172 weekends by applying a gray color to the former and a faint red to the
   4173 latter.  The idea for this approach is that the weekend should serve as
   4174 a subtle warning that no work is supposed to be done on that day, per
   4175 the design of traditional calendars.
   4176 
   4177 Users who prefer all days to look the same can configure the variable
   4178 ~calendar-weekend-days~ to either use gray of weekdays or the faint red of
   4179 weekends uniformly.
   4180 
   4181 #+begin_src emacs-lisp
   4182 ;; All are treated like weekdays (gray color)
   4183 (setq calendar-weekend-days nil)
   4184 
   4185 ;; All are treated like weekends (red-faint color)
   4186 (setq calendar-weekend-days (number-sequence 0 6))
   4187 
   4188 ;; The default marks the Saturday and Sunday as the weekend
   4189 (setq calendar-weekend-days '(0 6))
   4190 #+end_src
   4191 
   4192 For changes to take effect, the Calendar buffer needs to be generated
   4193 anew.
   4194 
   4195 ** Note on git-gutter in Doom Emacs
   4196 :PROPERTIES:
   4197 :CUSTOM_ID: h:a195e37c-e58c-4148-b254-8ba1ed8a731a
   4198 :END:
   4199 
   4200 The ~git-gutter~ and ~git-gutter-fr~ packages default to drawing
   4201 bitmaps for the indicators they display (e.g. bitmap of a plus sign
   4202 for added lines).  In Doom Emacs, these bitmaps are replaced with
   4203 contiguous lines which may look nicer, but require a change to the
   4204 foreground of the relevant faces to yield the desired color
   4205 combinations.
   4206 
   4207 Since this is Doom-specific, we urge users to apply changes in their
   4208 local setup.  Below is some sample code, based on what we cover at
   4209 length elsewhere in this manual:
   4210 
   4211 [[#h:f4651d55-8c07-46aa-b52b-bed1e53463bb][Advanced customization]].
   4212 
   4213 [[#h:51ba3547-b8c8-40d6-ba5a-4586477fd4ae][Use theme colors in code with modus-themes-with-colors]].
   4214 
   4215 #+begin_src emacs-lisp
   4216 (defun my-modus-themes-custom-faces ()
   4217   (modus-themes-with-colors
   4218     (custom-set-faces
   4219      ;; Make foreground the same as background for a uniform bar on
   4220      ;; Doom Emacs.
   4221      ;;
   4222      ;; Doom should not be implementing such hacks because themes
   4223      ;; cannot support them:
   4224      ;; <https://protesilaos.com/codelog/2022-08-04-doom-git-gutter-modus-themes/>.
   4225      `(git-gutter-fr:added ((,c :foreground ,bg-added-fringe)))
   4226      `(git-gutter-fr:deleted ((,c :foreground ,bg-removed-fringe)))
   4227      `(git-gutter-fr:modified ((,c :foreground ,bg-changed-fringe))))))
   4228 
   4229 (add-hook 'modus-themes-after-load-theme-hook #'my-modus-themes-custom-faces)
   4230 #+end_src
   4231 
   4232 As always, re-load the theme for changes to take effect.
   4233 
   4234 If the above does not work, try this instead:
   4235 
   4236 #+begin_src emacs-lisp
   4237 (after! modus-themes
   4238   (modus-themes-with-colors
   4239     (custom-set-faces
   4240      ;; Make foreground the same as background for a uniform bar on
   4241      ;; Doom Emacs.
   4242      ;;
   4243      ;; Doom should not be implementing such hacks because themes
   4244      ;; cannot support them:
   4245      ;; <https://protesilaos.com/codelog/2022-08-04-doom-git-gutter-modus-themes/>.
   4246      `(git-gutter-fr:added ((,c :foreground ,bg-added-intense)))
   4247      `(git-gutter-fr:deleted ((,c :foreground ,bg-removed-intense)))
   4248      `(git-gutter-fr:modified ((,c :foreground ,bg-changed-intense))))))
   4249 #+end_src
   4250 
   4251 ** Note on php-mode multiline comments
   4252 :PROPERTIES:
   4253 :CUSTOM_ID: h:d0a3157b-9c04-46e8-8742-5fb2a7ae8798
   4254 :END:
   4255 
   4256 Depending on your build of Emacs and/or the environment it runs in,
   4257 multiline comments in PHP with the ~php-mode~ package use the
   4258 ~font-lock-doc-face~ instead of ~font-lock-comment-face~.
   4259 
   4260 This seems to make all comments use the appropriate face:
   4261 
   4262 #+begin_src emacs-lisp
   4263 (defun my-multine-comments ()
   4264   (setq-local c-doc-face-name 'font-lock-comment-face))
   4265 
   4266 (add-hook 'php-mode-hook #'my-multine-comments)
   4267 #+end_src
   4268 
   4269 As always, re-load the theme for changes to take effect.
   4270 
   4271 ** Note on underlines in compilation buffers
   4272 :properties:
   4273 :custom_id: h:420f5a33-c7a9-4112-9b04-eaf2cbad96bd
   4274 :end:
   4275 
   4276 Various buffers that produce compilation results or run tests on code
   4277 apply an underline to the file names they reference or to relevant
   4278 messages.  Users may consider this unnecessary or excessive.
   4279 
   4280 To outright disable the effect, use this (buffers need to be generated
   4281 anew):
   4282 
   4283 #+begin_src emacs-lisp
   4284 (setq compilation-message-face nil)
   4285 #+end_src
   4286 
   4287 If some element of differentiation is still desired, a good option is to
   4288 render the affected text with the ~italic~ face:
   4289 
   4290 #+begin_src emacs-lisp
   4291 (setq compilation-message-face 'italic)
   4292 #+end_src
   4293 
   4294 [[#h:2793a224-2109-4f61-a106-721c57c01375][Configure bold and italic faces]].
   4295 
   4296 ** Note on inline Latex in Org buffers
   4297 :properties:
   4298 :custom_id: h:dd8478da-f56a-45cd-b199-b836c85c3c5a
   4299 :end:
   4300 
   4301 Org can work with inline latex and related syntax.  To actually fontify
   4302 those constructs, set the variable ~org-highlight-latex-and-related~ to
   4303 the desired list of values (per its doc string).  For example:
   4304 
   4305 #+begin_src emacs-lisp
   4306 (setq org-highlight-latex-and-related '(latex script))
   4307 #+end_src
   4308 
   4309 Remember to use {{{kbd(M-x org-mode-restart)}}} for changes to take effect.
   4310 
   4311 ** Note on dimmer.el
   4312 :properties:
   4313 :custom_id: h:8eb4b758-d318-4480-9ead-357a571beb93
   4314 :end:
   4315 
   4316 The {{{file(dimmer.el)}}} library by Neil Okamoto can be configured to
   4317 automatically dim the colors of inactive Emacs windows.  To guarantee
   4318 consistent results with the Modus themes, we suggest some tweaks to the
   4319 default styles, such as in this minimal setup:
   4320 
   4321 #+begin_src emacs-lisp
   4322 (use-package dimmer
   4323   :config
   4324   (setq dimmer-fraction 0.3)
   4325   (setq dimmer-adjustment-mode :foreground)
   4326   (setq dimmer-use-colorspace :rgb)
   4327 
   4328   (dimmer-mode 1))
   4329 #+end_src
   4330 
   4331 Of the above, we strongly recommend the RGB color space because it is
   4332 the one that remains faithful to the hueness of the colors used by the
   4333 themes.  Whereas the default CIELAB space has a tendency to distort
   4334 colors in addition to applying the dim effect, which can be somewhat
   4335 disorienting.
   4336 
   4337 The value of the ~dimmer-fraction~ has been selected empirically.  Users
   4338 might prefer to tweak it further (increasing it makes the dim effect
   4339 more pronounced).
   4340 
   4341 Changing the ~dimmer-adjustment-mode~ is a matter of preference.  Though
   4342 because the Modus themes use black and white as their base colors, any
   4343 other value for that variable will turn the main background gray.  This
   4344 inadvertently leads to the opposite of the intended utility of this
   4345 package: it draws too much attention to unfocused windows.
   4346 
   4347 ** Note on display-fill-column-indicator-mode
   4348 :properties:
   4349 :custom_id: h:2a602816-bc1b-45bf-9675-4cbbd7bf6cab
   4350 :end:
   4351 
   4352 The ~display-fill-column-indicator-mode~ uses a typographic character to
   4353 draw its line.  This has the downside of creating a dashed line.  The
   4354 dashes are further apart depending on how tall the font's glyph height
   4355 is and what integer the ~line-spacing~ is set to.
   4356 
   4357 At the theme level we eliminate this effect by making the character one
   4358 pixel tall: the line is contiguous.  Users who prefer the dashed line
   4359 are advised to change the ~fill-column-indicator~ face, as explained
   4360 elsewhere in this document.  For example:
   4361 
   4362 #+begin_src emacs-lisp
   4363 (modus-themes-with-colors
   4364   (custom-set-faces
   4365    `(fill-column-indicator ((,c :foreground ,bg-active)))))
   4366 #+end_src
   4367 
   4368 [[#h:51ba3547-b8c8-40d6-ba5a-4586477fd4ae][Use theme colors in code with modus-themes-with-colors]].
   4369 
   4370 To make the line thicker, set the height to be equal to the base font
   4371 size instead of the one pixel we use.  This is done by specifying a rate
   4372 instead of an absolute number, as in =:height 1.0= versus =:height 1=.
   4373 For example:
   4374 
   4375 #+begin_src emacs-lisp
   4376 (modus-themes-with-colors
   4377   (custom-set-faces
   4378    `(fill-column-indicator ((,c :height 1.0 :background ,bg-inactive :foreground ,bg-inactive)))))
   4379 #+end_src
   4380 
   4381 ** Note on highlight-parentheses.el
   4382 :PROPERTIES:
   4383 :CUSTOM_ID: h:24bab397-dcb2-421d-aa6e-ec5bd622b913
   4384 :END:
   4385 
   4386 The ~highlight-parentheses~ package provides contextual coloration of
   4387 surrounding parentheses, highlighting only those which are around the
   4388 point.  The package expects users to customize the applicable colors
   4389 on their own by configuring certain variables.
   4390 
   4391 To make the Modus themes work as expected with this, we need to use some
   4392 of the techniques that are discussed at length in the various
   4393 "Do-It-Yourself" (DIY) sections, which provide insight into the more
   4394 advanced customization options of the themes.
   4395 
   4396 [[#h:f4651d55-8c07-46aa-b52b-bed1e53463bb][Advanced customization]].
   4397 
   4398 In the following example, we are assuming that the user wants to (i)
   4399 re-use color variables provided by the themes, (ii) be able to retain
   4400 their tweaks while switching between ~modus-operandi~ and ~modus-vivendi~,
   4401 and (iii) have the option to highlight either the foreground of the
   4402 parentheses or the background as well.
   4403 
   4404 We start by defining our own variable, which will serve as a toggle
   4405 between foreground and background coloration styles:
   4406 
   4407 #+begin_src emacs-lisp
   4408 (defvar my-highlight-parentheses-use-background t
   4409   "Prefer `highlight-parentheses-background-colors'.")
   4410 #+end_src
   4411 
   4412 Then we can update our preference with this:
   4413 
   4414 #+begin_src emacs-lisp
   4415 ;; Set to nil to disable backgrounds.
   4416 (setq my-highlight-parentheses-use-background nil)
   4417 #+end_src
   4418 
   4419 To re-use colors from the themes, we must wrap our code in the
   4420 ~modus-themes-with-colors~ macro.  Our implementation must interface with
   4421 the variables ~highlight-parentheses-background-colors~ and/or
   4422 ~highlight-parentheses-colors~.
   4423 
   4424 So we can have something like this (the doc string of
   4425 ~modus-themes-with-colors~ explains where the names of the colors can be
   4426 found):
   4427 
   4428 #+begin_src emacs-lisp
   4429 (modus-themes-with-colors
   4430     ;; Our preference for setting either background or foreground
   4431     ;; styles, depending on `my-highlight-parentheses-use-background'.
   4432     (if my-highlight-parentheses-use-background
   4433 
   4434         ;; Here we set color combinations that involve both a background
   4435         ;; and a foreground value.
   4436         (setq highlight-parentheses-background-colors (list bg-cyan-intense
   4437                                                             bg-magenta-intense
   4438                                                             bg-green-intense
   4439                                                             bg-yellow-intense)
   4440               highlight-parentheses-colors (list cyan
   4441                                                  magenta
   4442                                                  green
   4443                                                  yellow))
   4444 
   4445       ;; And here we pass only foreground colors while disabling any
   4446       ;; backgrounds.
   4447       (setq highlight-parentheses-colors (list green-intense
   4448                                                magenta-intense
   4449                                                blue-intense
   4450                                                red-intense)
   4451             highlight-parentheses-background-colors nil)))
   4452 
   4453 ;; Include this if you also want to make the parentheses bold:
   4454 (set-face-attribute 'highlight-parentheses-highlight nil :inherit 'bold)
   4455 
   4456 ;; Our changes must be evaluated before enabling the relevant mode, so
   4457 ;; this comes last.
   4458 (global-highlight-parentheses-mode 1)
   4459 #+end_src
   4460 
   4461 For our changes to persist while switching between the Modus themes, we
   4462 need to include them in a function which can then get passed to
   4463 ~modus-themes-after-load-theme-hook~.  This is the complete
   4464 implementation:
   4465 
   4466 #+begin_src emacs-lisp
   4467 ;; Configurations for `highlight-parentheses':
   4468 (require 'highlight-parentheses)
   4469 
   4470 (defvar my-highlight-parentheses-use-background t
   4471   "Prefer `highlight-parentheses-background-colors'.")
   4472 
   4473 (setq my-highlight-parentheses-use-background nil) ; Set to nil to disable backgrounds
   4474 
   4475 (defun my-modus-themes-highlight-parentheses ()
   4476   (modus-themes-with-colors
   4477     ;; Our preference for setting either background or foreground
   4478     ;; styles, depending on `my-highlight-parentheses-use-background'.
   4479     (if my-highlight-parentheses-use-background
   4480 
   4481         ;; Here we set color combinations that involve both a background
   4482         ;; and a foreground value.
   4483         (setq highlight-parentheses-background-colors (list bg-cyan-intense
   4484                                                             bg-magenta-intense
   4485                                                             bg-green-intense
   4486                                                             bg-yellow-intense)
   4487               highlight-parentheses-colors (list cyan
   4488                                                  magenta
   4489                                                  green
   4490                                                  yellow))
   4491 
   4492       ;; And here we pass only foreground colors while disabling any
   4493       ;; backgrounds.
   4494       (setq highlight-parentheses-colors (list green-intense
   4495                                                magenta-intense
   4496                                                blue-intense
   4497                                                red-intense)
   4498             highlight-parentheses-background-colors nil)))
   4499 
   4500   ;; Include this if you also want to make the parentheses bold:
   4501   (set-face-attribute 'highlight-parentheses-highlight nil :inherit 'bold)
   4502 
   4503   ;; Our changes must be evaluated before enabling the relevant mode, so
   4504   ;; this comes last.
   4505   (global-highlight-parentheses-mode 1))
   4506 
   4507 (add-hook 'modus-themes-after-load-theme-hook #'my-modus-themes-highlight-parentheses)
   4508 #+end_src
   4509 
   4510 As always, re-load the theme for changes to take effect.
   4511 
   4512 ** Note on mmm-mode.el background colors
   4513 :properties:
   4514 :custom_id: h:99cf0d6c-e478-4e26-9932-3bf3427d13f6
   4515 :end:
   4516 
   4517 The faces used by {{{file(mmm-mode.el)}}} are expected to have a colorful
   4518 background, while they should not touch any foreground value.  The idea
   4519 is that they must not interfere with existing fontification.  Those
   4520 background colors need to be distinct from each other, such as an
   4521 unambiguous red juxtaposed with a clear blue.
   4522 
   4523 While this design may be internally consistent with the raison d'être of
   4524 that library, it inevitably produces inaccessible color combinations.
   4525 
   4526 There are two competing goals at play:
   4527 
   4528 1. Legibility of the text, understood as the contrast ratio between the
   4529    background and the foreground.
   4530 
   4531 2. Semantic precision of each face which entails faithfulness to
   4532    color-coding of the underlying background.
   4533 
   4534 As the Modus themes are designed with the express purpose of conforming
   4535 with the first point, we have to forgo the apparent color-coding of the
   4536 background elements.  Instead we use subtle colors that do not undermine
   4537 the legibility of the affected text while they still offer a sense of
   4538 added context.
   4539 
   4540 Users who might prefer to fall below the minimum 7:1 contrast ratio in
   4541 relative luminance (the accessibility target we conform with), can opt
   4542 to configure the relevant faces on their own.
   4543 
   4544 [[#h:51ba3547-b8c8-40d6-ba5a-4586477fd4ae][Use theme colors in code with modus-themes-with-colors]].
   4545 
   4546 This example uses more vivid background colors, though it comes at the
   4547 very high cost of degraded legibility.
   4548 
   4549 #+begin_src emacs-lisp
   4550 (modus-themes-with-colors
   4551   (custom-set-faces
   4552    `(mmm-cleanup-submode-face ((,c :background ,bg-yellow-intense)))
   4553    `(mmm-code-submode-face ((,c :background ,bg-inactive)))
   4554    `(mmm-comment-submode-face ((,c :background ,bg-blue-intense)))
   4555    `(mmm-declaration-submode-face ((,c :background ,bg-cyan-intense)))
   4556    `(mmm-default-submode-face ((,c :background ,bg-dim)))
   4557    `(mmm-init-submode-face ((,c :background ,bg-magenta-intense)))
   4558    `(mmm-output-submode-face ((,c :background ,bg-red-intense)))
   4559    `(mmm-special-submode-face ((,c :background ,bg-green-intense)))))
   4560 #+end_src
   4561 
   4562 ** Note on prism.el
   4563 :properties:
   4564 :alt_title: Note for prism
   4565 :custom_id: h:a94272e0-99da-4149-9e80-11a7e67a2cf2
   4566 :end:
   4567 
   4568 This package by Adam Porter, aka "alphapapa" or "github-alphapapa",
   4569 implements an alternative to the typical coloration of code.  Instead of
   4570 highlighting the syntactic constructs, it applies color to different
   4571 levels of depth in the code structure.
   4572 
   4573 As {{{file(prism.el)}}} offers a broad range of customizations, we
   4574 cannot style it directly at the theme level: that would run contrary
   4575 to the spirit of the package.  Instead, we may offer preset color
   4576 schemes.  Those should offer a starting point for users to adapt to
   4577 their needs.
   4578 
   4579 In the following code snippets, we employ the ~modus-themes-with-colors~
   4580 macro: [[#h:51ba3547-b8c8-40d6-ba5a-4586477fd4ae][Use theme colors in code with modus-themes-with-colors]].
   4581 
   4582 These are the minimum recommended settings with 16 colors:
   4583 
   4584 #+begin_src emacs-lisp
   4585 (setq prism-num-faces 16)
   4586 
   4587 (prism-set-colors
   4588   :desaturations '(0) ; do not change---may lower the contrast ratio
   4589   :lightens '(0)      ; same
   4590   :colors (modus-themes-with-colors
   4591             (list fg-main
   4592                   magenta
   4593                   cyan-cooler
   4594                   magenta-cooler
   4595                   blue
   4596                   magenta-warmer
   4597                   cyan-warmer
   4598                   red-cooler
   4599                   green
   4600                   fg-main
   4601                   cyan
   4602                   yellow
   4603                   blue-warmer
   4604                   red-warmer
   4605                   green-cooler
   4606                   yellow-faint)))
   4607 #+end_src
   4608 
   4609 With 8 colors:
   4610 
   4611 #+begin_src emacs-lisp
   4612 (setq prism-num-faces 8)
   4613 
   4614 (prism-set-colors
   4615   :desaturations '(0) ; do not change---may lower the contrast ratio
   4616   :lightens '(0)      ; same
   4617   :colors (modus-themes-with-colors
   4618             (list blue
   4619                   magenta
   4620                   magenta-cooler
   4621                   cyan-cooler
   4622                   fg-main
   4623                   blue-warmer
   4624                   red-cooler
   4625                   cyan)))
   4626 #+end_src
   4627 
   4628 And this is with 4 colors, which produces results that are the closest
   4629 to the themes' default aesthetic:
   4630 
   4631 #+begin_src emacs-lisp
   4632 (setq prism-num-faces 4)
   4633 
   4634 (prism-set-colors
   4635   :desaturations '(0) ; do not change---may lower the contrast ratio
   4636   :lightens '(0)      ; same
   4637   :colors (modus-themes-with-colors
   4638             (list blue
   4639                   magenta
   4640                   magenta-cooler
   4641                   green-warmer)))
   4642 #+end_src
   4643 
   4644 If you need to apply desaturation and lightening, you can use what the
   4645 {{{file(prism.el)}}} documentation recommends, like this (adapting to the
   4646 examples with the 4, 8, 16 colors):
   4647 
   4648 #+begin_src emacs-lisp
   4649 (prism-set-colors
   4650   :desaturations (cl-loop for i from 0 below 16 collect (* i 2.5))
   4651   :lightens (cl-loop for i from 0 below 16 collect (* i 2.5))
   4652   :colors (modus-themes-with-colors
   4653             (list fg-main
   4654                   cyan-cooler
   4655                   magenta-cooler
   4656                   magenta)))
   4657 #+end_src
   4658 
   4659 ** Note on company-mode overlay pop-up
   4660 :properties:
   4661 :custom_id: h:20cef8c4-d11f-4053-8b2c-2872925780b1
   4662 :end:
   4663 
   4664 By default, the ~company-mode~ pop-up that lists completion candidates is
   4665 drawn using an overlay.  This creates alignment issues every time it is
   4666 placed above a piece of text that has a different height than the
   4667 default.
   4668 
   4669 The solution recommended by the project's maintainer is to use an
   4670 alternative front-end for drawing the pop-up which draws child frames
   4671 instead of overlays.[fn::
   4672 https://github.com/company-mode/company-mode/issues/1010][fn::
   4673 https://github.com/tumashu/company-posframe/]
   4674 
   4675 Also consider the ~corfu~ package.
   4676 
   4677 ** Note on ERC escaped color sequences
   4678 :properties:
   4679 :custom_id: h:98bdf319-1e32-4469-8a01-771200fba65c
   4680 :end:
   4681 
   4682 The built-in IRC client ~erc~ has the ability to colorize any text using
   4683 escape sequences that start with =^C= (inserted with {{{kbd(C-q C-c)}}}) and are
   4684 followed by a number for the foreground and background.[fn:: This page
   4685 explains the basics, though it is not specific to Emacs:
   4686 https://www.mirc.com/colors.html] Possible numbers are 0-15, with the
   4687 first entry being the foreground and the second the background,
   4688 separated by a comma.  Like this =^C1,6=.  The minimum setup is this:
   4689 
   4690 #+begin_src emacs-lisp
   4691 (add-to-list 'erc-modules 'irccontrols)
   4692 (setq erc-interpret-controls-p t
   4693       erc-interpret-mirc-color t)
   4694 #+end_src
   4695 
   4696 As this allows users the chance to make arbitrary combinations, it is
   4697 impossible to guarantee a consistently high contrast ratio.  All we can
   4698 we do is provide guidance on the combinations that satisfy the
   4699 accessibility standard of the themes:
   4700 
   4701 + Modus Operandi :: Use foreground color 1 for all backgrounds from
   4702   2-15.  Like so: {{{kbd(C-q C-c1,N)}}} where =N= is the background.
   4703 
   4704 + Modus Vivendi :: Use foreground color 0 for all backgrounds from
   4705   2-13.  Use foreground =1= for backgrounds 14, 15.
   4706 
   4707 Colors 0 and 1 are white and black respectively.  So combine them
   4708 together, if you must.
   4709 
   4710 ** Note on powerline or spaceline
   4711 :properties:
   4712 :custom_id: h:9130a8ba-d8e3-41be-a58b-3cb1eb7b6d17
   4713 :end:
   4714 
   4715 Both Powerline and Spaceline package users will likely need to use the
   4716 command ~powerline-reset~ whenever they make changes to their themes
   4717 and/or mode line setup.
   4718 
   4719 ** Note on SHR colors
   4720 :properties:
   4721 :custom_id: h:4cc767dc-ffef-4c5c-9f10-82eb7b8921bf
   4722 :end:
   4723 
   4724 Emacs' HTML rendering library ({{{file(shr.el)}}}) may need explicit
   4725 configuration to respect the theme's colors instead of whatever
   4726 specifications the webpage provides.
   4727 
   4728 Consult the doc string of ~shr-use-colors~.
   4729 
   4730 ** Note on SHR fonts
   4731 :properties:
   4732 :custom_id: h:e6c5451f-6763-4be7-8fdb-b4706a422a4c
   4733 :end:
   4734 #+cindex: Fonts in EWW, Elfeed, Ement, and SHR
   4735 
   4736 By default, packages that build on top of the Simple HTML Remember
   4737 (~shr~) use proportionately spaced fonts.  This is controlled by the
   4738 user option ~shr-use-fonts~, which is set to non-~nil~ by default.  To
   4739 use the standard font instead, set that variable to ~nil~.
   4740 
   4741 [[#h:defcf4fc-8fa8-4c29-b12e-7119582cc929][Font configurations for Org and others]].
   4742 
   4743 Packages affected by this are:
   4744 
   4745 + elfeed
   4746 + ement
   4747 + eww
   4748 
   4749 This is a non-exhaustive list.
   4750 
   4751 ** Note on Ement colors and fonts
   4752 :properties:
   4753 :custom_id: h:8e636056-356c-4ca7-bc78-ebe61031f585
   4754 :end:
   4755 
   4756 The {{{file(ement.el)}}} library by Adam Porter (also known as
   4757 "alphapapa") defaults to a method of colorizing usernames in a rainbow
   4758 style.  This is controlled by the user option ~ement-room-prism~ and
   4759 can be disabled with:
   4760 
   4761 #+begin_src emacs-lisp
   4762 (setq ement-room-prism nil)
   4763 #+end_src
   4764 
   4765 The contrast ratio of these colors is governed by another user option:
   4766 ~ement-room-prism-minimum-contrast~.  By default, it is set to 6 which is
   4767 slightly below our nominal target.  Try this instead:
   4768 
   4769 #+begin_src emacs-lisp
   4770 (setq ement-room-prism-minimum-contrast 7)
   4771 #+end_src
   4772 
   4773 With regard to fonts, Ement depends on ~shr~ ([[#h:e6c5451f-6763-4be7-8fdb-b4706a422a4c][Note on SHR fonts]]).
   4774 
   4775 Since we are here, here is an excerpt from Ement's source code:
   4776 
   4777 #+begin_src emacs-lisp
   4778 (defcustom ement-room-prism-minimum-contrast 6
   4779   "Attempt to enforce this minimum contrast ratio for user faces.
   4780 This should be a reasonable number from, e.g. 0-7 or so."
   4781   ;; Prot would almost approve of this default.  :) I would go all the way
   4782   ;; to 7, but 6 already significantly dilutes the colors in some cases.
   4783   :type 'number)
   4784 #+end_src
   4785 
   4786 Yes, I do approve of that default.  Even a 4.5 (the WCAG AA rating)
   4787 would be a good baseline for many themes and/or user configurations.
   4788 Our target is the highest of the sort, though we do not demand that
   4789 everyone conforms with it.
   4790 
   4791 ** Note on pdf-tools link hints
   4792 :properties:
   4793 :custom_id: h:2659d13e-b1a5-416c-9a89-7c3ce3a76574
   4794 :end:
   4795 
   4796 Hints are drawn by [[https://imagemagick.org/][ImageMagick]], not Emacs, i.e., ImageMagick doesn't
   4797 know about the hint face unless you tell ImageMagick about it.  By
   4798 default, only the foreground and background color attributes are
   4799 passed.  The below snippet adds to those the various font attributes.  As
   4800 it queries various faces, specifically ~pdf-links-read-link~ and the faces
   4801 it inherits, it needs to be added to your initialization file after
   4802 you've customized any faces.
   4803 
   4804 #+begin_src emacs-lisp
   4805 (use-package pdf-links
   4806   :config
   4807   (let ((spec
   4808          (apply #'append
   4809                 (mapcar
   4810                  (lambda (name)
   4811                    (list name
   4812                          (face-attribute 'pdf-links-read-link
   4813                                          name nil 'default)))
   4814                  '(:family :width :weight :slant)))))
   4815     (setq pdf-links-read-link-convert-commands
   4816           `("-density"    "96"
   4817             "-family"     ,(plist-get spec :family)
   4818             "-stretch"    ,(let* ((width (plist-get spec :width))
   4819                                   (name (symbol-name width)))
   4820                              (replace-regexp-in-string "-" ""
   4821                                                        (capitalize name)))
   4822             "-weight"     ,(pcase (plist-get spec :weight)
   4823                              ('ultra-light "Thin")
   4824                              ('extra-light "ExtraLight")
   4825                              ('light       "Light")
   4826                              ('semi-bold   "SemiBold")
   4827                              ('bold        "Bold")
   4828                              ('extra-bold  "ExtraBold")
   4829                              ('ultra-bold  "Black")
   4830                              (_weight      "Normal"))
   4831             "-style"      ,(pcase (plist-get spec :slant)
   4832                              ('italic  "Italic")
   4833                              ('oblique "Oblique")
   4834                              (_slant   "Normal"))
   4835             "-pointsize"  "%P"
   4836             "-undercolor" "%f"
   4837             "-fill"       "%b"
   4838             "-draw"       "text %X,%Y '%c'"))))
   4839 #+end_src
   4840 
   4841 ** Note on the Notmuch logo
   4842 :properties:
   4843 :custom_id: h:636af312-54a5-4918-84a6-0698e85a3c6d
   4844 :end:
   4845 
   4846 By default, the "hello" buffer of Notmuch includes a header with the
   4847 programs' logo and a couple of buttons.  The logo has the effect of
   4848 enlarging the height of the line, which negatively impacts the shape of
   4849 those buttons.  Disabling the logo fixes the problem:
   4850 
   4851 #+begin_src emacs-lisp
   4852 (setq notmuch-show-logo nil)
   4853 #+end_src
   4854 
   4855 ** Note on goto-address-mode faces
   4856 :PROPERTIES:
   4857 :CUSTOM_ID: h:2d74236a-e41c-4616-8735-75f949a67334
   4858 :END:
   4859 
   4860 The built-in ~goto-address-mode~ uses heuristics to identify URLs and
   4861 email addresses in the current buffer.  It then applies a face to them
   4862 to change their style.  Some packages, such as ~notmuch~, use this
   4863 minor-mode automatically.
   4864 
   4865 The faces are not declared with ~defface~, meaning that it is better
   4866 that the theme does not modify them.  The user is thus encouraged to
   4867 consider including (or equivalent) this in their setup:
   4868 
   4869 #+begin_src emacs-lisp
   4870 (setq goto-address-url-face 'link
   4871       goto-address-url-mouse-face 'highlight
   4872       goto-address-mail-face 'link
   4873       goto-address-mail-mouse-face 'highlight)
   4874 #+end_src
   4875 
   4876 My personal preference is to set ~goto-address-mail-face~ to ~nil~, as
   4877 it otherwise adds too much visual noise to the buffer (email addresses
   4878 stand out more, due to the use of the uncommon =@= character but also
   4879 because they are often enclosed in angled brackets).
   4880 
   4881 * Frequently Asked Questions
   4882 :properties:
   4883 :custom_id: h:b3384767-30d3-4484-ba7f-081729f03a47
   4884 :end:
   4885 #+cindex: Frequently Asked Questions
   4886 
   4887 In this section we provide answers related to some aspects of the Modus
   4888 themes' design and application.
   4889 
   4890 ** Is the contrast ratio about adjacent colors?
   4891 :properties:
   4892 :custom_id: h:5ce7ae2e-9348-4e55-b4cf-9302345b1826
   4893 :end:
   4894 #+cindex: Contrast between adjacent colors
   4895 
   4896 The minimum contrast ratio in relative luminance that the themes conform
   4897 with always refers to any given combination of background and foreground
   4898 colors.  If we have some blue colored text next to a magenta one, both
   4899 against a white background, we do not mean to imply that blue:magenta is
   4900 7:1 in terms of relative luminance.  Rather, we state that blue:white
   4901 and magenta:white each are 7:1 or higher.
   4902 
   4903 The point of reference is always the background.  Because colors have
   4904 about the same minimum distance in luminance from their backdrop, they
   4905 necessarily are fairly close to each other in this measure.  A possible
   4906 blue:magenta combination would naturally be around 1:1 in contrast of
   4907 the sort here considered.
   4908 
   4909 To differentiate between sequential colors, we rely on hueness by
   4910 mapping contrasting hues to adjacent constructs, while avoiding
   4911 exaggerations.  A blue next to a magenta can be told apart regardless of
   4912 their respective contrast ratio against their common background.
   4913 Exceptions would be tiny characters in arguably not so realistic cases,
   4914 such as two dots drawn side-by-side which for some reason would need to
   4915 be colored differently.  They would still be legible though, which is
   4916 the primary objective of the Modus themes.
   4917 
   4918 ** What does it mean to avoid exaggerations?
   4919 :properties:
   4920 :custom_id: h:44284e1f-fab8-4c4f-92f0-544728a7c91e
   4921 :end:
   4922 #+cindex: Avoiding exaggerations in design
   4923 
   4924 The Modus themes are designed with restraint, so that their default
   4925 looks do not overdo it with the application of color.
   4926 
   4927 [[#h:bf1c82f2-46c7-4eb2-ad00-dd11fdd8b53f][Customization Options]].
   4928 
   4929 This is the non-quantifiable aspect of the themes' design: the artistic
   4930 part, if you will.  There are a lot of cases where color can be used
   4931 inconsiderately, without accounting for layout, typographic, or other
   4932 properties of the presentation.  For example, two headings with distinct
   4933 markers, such as leading asterisks in Org buffers, do not have to have
   4934 highly contrasting hues between them in order to be told apart: the
   4935 added element of contrast in hueness does not contribute significantly
   4936 more to the distinction between the headings than colors whose hues are
   4937 relatively closer to each other in the color space.
   4938 
   4939 Exaggerations can be hard to anticipate or identify.  Multiple shades of
   4940 blue and magenta in the same context may not seem optimal: one might
   4941 think that it would be better to use highly contrasting hues to ensure
   4942 that all colors stand out, such as by placing blue next to yellow, next
   4943 to magenta, and green.  That would, however, be a case of design for its
   4944 own sake; a case where color is being applied without consideration of
   4945 its end results in the given context.  Too many contrasting hues in
   4946 close proximity force an erratic rate to how the eye jumps from one
   4947 piece of text to the next.  Whereas multiple shades of, say, blue and
   4948 magenta can suffice to tell things apart and avoid excess coloration: a
   4949 harmonious rhythm.
   4950 
   4951 ** Why are colors mostly variants of blue, magenta, cyan?
   4952 :properties:
   4953 :custom_id: h:0b26cb47-9733-4cb1-87d9-50850cb0386e
   4954 :end:
   4955 #+cindex: Innate color qualities of the palette
   4956 
   4957 Due to the innate properties of color, some options are better than
   4958 others for the accessibility purposes of the themes, the stylistic
   4959 consistency between ~modus-operandi~ and ~modus-vivendi~, and the avoidance
   4960 of exaggerations in design.
   4961 
   4962 [[#h:44284e1f-fab8-4c4f-92f0-544728a7c91e][What does it mean to avoid exaggerations?]]
   4963 
   4964 What we describe as color is a function of three distinct channels of
   4965 light: red, green, blue.  In hexadecimal RGB notation, a color value is
   4966 read as three pairs of red, green, and blue light: =#RRGGBB=.  Of those
   4967 three, the most luminant is green, while the least luminant is blue.
   4968 
   4969 The three basic colors represent each of the channels of light.  They
   4970 can be intermixed to give us six colors: red and green derive yellow,
   4971 green and blue make cyan, red and blue turn into magenta.
   4972 
   4973 We can test the luminance of each of those against white and black to
   4974 get a sense of how not all colors are equally good for accessibility
   4975 (white is =#ffffff=, which means that all three light channels are fully
   4976 luminated, while black is =#000000= meaning that no light is present
   4977 (notwithstanding display technology)).
   4978 
   4979 #+begin_example
   4980 | Name    |         | #ffffff | #000000 |
   4981 |---------+---------+---------+---------|
   4982 | red     | #ff0000 |    4.00 |    5.25 |
   4983 | yellow  | #ffff00 |    1.07 |   19.56 |
   4984 | green   | #00ff00 |    1.37 |   15.30 |
   4985 | cyan    | #00ffff |    1.25 |   16.75 |
   4986 | blue    | #0000ff |    8.59 |    2.44 |
   4987 | magenta | #ff00ff |    3.14 |    6.70 |
   4988 #+end_example
   4989 
   4990 [[#h:02e25930-e71a-493d-828a-8907fc80f874][Measure color contrast]].
   4991 
   4992 By reading this table we learn that every color that has a high level of
   4993 green light (green, yellow, cyan) is virtually unreadable against a
   4994 white background and, conversely, can be easily read against black.
   4995 
   4996 We can then infer that red and blue, in different combinations, with
   4997 green acting as calibrator for luminance, will give us fairly moderate
   4998 colors that pass the 7:1 target.  Blue with a bit of green produce
   4999 appropriate variants of cyan.  Similarly, blue combined with some red
   5000 and hints of green give us suitable shades of purple.
   5001 
   5002 Due to the need of maintaining some difference in hueness between
   5003 adjacent colors, it is not possible to make red, green, and yellow the
   5004 main colors, because blue cannot be used to control their luminance and,
   5005 thus the relevant space will shrink considerably.
   5006 
   5007 [[#h:5ce7ae2e-9348-4e55-b4cf-9302345b1826][Is the contrast ratio about adjacent colors?]]
   5008 
   5009 This phenomenon is best illustrated by the following table that measures
   5010 the relative luminance of shades of red, yellow, magenta against white:
   5011 
   5012 #+begin_example
   5013 |         | #ffffff |
   5014 |---------+---------|
   5015 | #990000 |    8.92 |
   5016 | #995500 |    5.75 |
   5017 | #990099 |    7.46 |
   5018 #+end_example
   5019 
   5020 We notice that equal values of red and blue light in =#990099= (magenta
   5021 shade) do not lead to a considerable change in luminance compared with
   5022 =#990000= (red variant).  Whereas less amount of green light in =#995500=
   5023 leads to a major drop in luminance relative to white.  It follows that
   5024 using the green channel of light to calibrate the luminance of colors is
   5025 more effective than trying to do the same with either red or blue (the
   5026 latter is the least effective in that regard).
   5027 
   5028 When we need to work with several colors, it is always better to have
   5029 sufficient manoeuvring space, especially since we cannot pick arbitrary
   5030 colors but only those that satisfy the accessibility objectives of the
   5031 themes.
   5032 
   5033 As for why we do not mostly use green, yellow, cyan for the dark theme,
   5034 it is because those colors are far more luminant than their counterparts
   5035 on the other side of the spectrum, so to ensure that they all have about
   5036 the same contrast ratios we would have to alter their hueness
   5037 considerably.  In short, the effect would not be optimal as it would
   5038 lead to exaggerations.  Plus, it would make ~modus-vivendi~ look
   5039 completely different than ~modus-operandi~, to the effect that the two
   5040 could not be properly considered part of the same project.
   5041 
   5042 ** What is the best setup for legibility?
   5043 :properties:
   5044 :custom_id: h:f60cc2ae-129d-47c0-9849-4f6bbd87d8be
   5045 :end:
   5046 #+cindex: General setup for readability
   5047 
   5048 The Modus themes can be conceptually simplified as combinations of color
   5049 values that account for relative luminance and inner harmony.  Those
   5050 qualities do not guarantee that every end-user will have the same
   5051 experience, due to differences between people, but also because of
   5052 variances in hardware capabilities and configurations.  For the purposes
   5053 of this document, we may only provide suggestions pertaining to the
   5054 latter case.
   5055 
   5056 ~modus-operandi~ is best used outdoors or in a room that either gets
   5057 direct sunlight or has plenty of light.  Whereas ~modus-vivendi~ works
   5058 better when there is not a lot of sunshine or the room has a source of
   5059 light that is preferably a faint and/or warm one.  It is possible to use
   5060 ~modus-operandi~ at night and ~modus-vivendi~ during the day, though that
   5061 will depend on several variables, such as one's overall perception of
   5062 color, the paint on the walls and how that contributes to the impression
   5063 of lightness in the room, the sense of space within the eye's peripheral
   5064 vision, hardware specifications, and environmental factors.
   5065 
   5066 In general, an additional source of light other than that of the monitor
   5067 can help reduce eye strain: the eyes are more relaxed when they do not
   5068 have to focus on one point to gather light.
   5069 
   5070 The monitor's display settings must be accounted for.  Gamma values, in
   5071 particular, need to be calibrated to neither amplify nor distort the
   5072 perception of black.  Same principle for sharpness, brightness, and
   5073 contrast as determined by the hardware, which all have an effect on how
   5074 text is read on the screen.
   5075 
   5076 There are software level methods on offer, such as the XrandR utility
   5077 for the X Window System (X.org), which can make gamma corrections for
   5078 each of the three channels of light (red, green, blue).  For example:
   5079 
   5080 : xrandr --output LVDS1 --brightness 1.0 --gamma 0.76:0.75:0.68
   5081 
   5082 Typography is another variable.  Some font families are blurry at small
   5083 point sizes.  Others may have a regular weight that is lighter (thiner)
   5084 than that of their peers which may, under certain circumstances, cause a
   5085 halo effect around each glyph.
   5086 
   5087 The gist is that legibility cannot be fully solved at the theme level.
   5088 The color combinations may have been optimized for accessibility, though
   5089 the remaining contributing factors in each case need to be considered in
   5090 full.
   5091 
   5092 ** Are these color schemes?
   5093 :properties:
   5094 :custom_id: h:a956dbd3-8fd2-4f5d-8b01-5f881268cf2b
   5095 :end:
   5096 #+cindex: Themes, not color schemes
   5097 
   5098 No, the Modus themes are not color schemes.
   5099 
   5100 A color scheme is a collection of colors.  A good color scheme is a
   5101 combination of colors with an inner logic or abstract structure.
   5102 
   5103 A theme is a set of patterns that are applied across different contexts.
   5104 A good theme is one that does so with consistency, though not
   5105 uniformity.
   5106 
   5107 In practical terms, a color scheme is what one uses when, for example,
   5108 they replace the first sixteen escape sequences of a terminal emulator
   5109 with color values of their preference.  The terminal offers the option
   5110 to choose, say, the exact value of what counts as "red", but does not
   5111 provide the means to control where that is mapped to and whether it
   5112 should also have other qualities such as a bold weight for the
   5113 underlying text or an added background color.  In contradistinction,
   5114 Emacs uses constructs known as "faces" which allow the user/developer
   5115 to specify where a given color will be used and whether it should be
   5116 accompanied by other typographic or stylistic attributes.
   5117 
   5118 By configuring the multitude of faces on offer we thus control both
   5119 which colors are applied and how they appear in their context.  When a
   5120 package wants to render each instance of "foo" with the "bar" face, it
   5121 is not requesting a specific color, which makes things considerably more
   5122 flexible as we can treat "bar" in its own right without necessarily
   5123 having to use some color value that we hardcoded somewhere.
   5124 
   5125 Which brings us to the distinction between consistency and uniformity
   5126 where our goal is always the former: we want things to look similar
   5127 across all interfaces, but we must never force a visual identity where
   5128 that runs contrary to the functionality of the given interface.  For
   5129 instance, all links are underlined by default yet there are cases such
   5130 as when viewing listings of emails in Gnus (and Mu4e, Notmuch) where (i)
   5131 it is already understood that one must follow the indicator or headline
   5132 to view its contents and (ii) underlining everything would make the
   5133 interface virtually unusable.
   5134 
   5135 Again, one must exercise judgement in order to avoid discrimination,
   5136 where "discrimination" refers to:
   5137 
   5138 + The treatment of substantially different magnitudes as if they were of
   5139   the same class.
   5140 + Or the treatment of the same class of magnitudes as if they were of a
   5141   different class.
   5142 
   5143 (To treat similar things differently; to treat dissimilar things alike.)
   5144 
   5145 If, in other words, one is to enforce uniformity without accounting
   5146 for the particular requirements of each case---the contextual demands
   5147 for usability beyond matters of color---they are making a
   5148 not-so-obvious error of treating different cases as if they were the
   5149 same.
   5150 
   5151 The Modus themes prioritize "thematic consistency" over abstract harmony
   5152 or regularity among their applicable colors.  In concrete terms, we do
   5153 not claim that, say, our yellows are the best complements for our blues
   5154 because we generally avoid using complementary colors side-by-side, so
   5155 it is wrong to optimize for a decontextualised blue+yellow combination.
   5156 Not to imply that our colors do not work well together because they do,
   5157 just to clarify that consistency of context is what themes must strive
   5158 for, and that requires widening the scope of the design beyond the
   5159 particularities of a color scheme.
   5160 
   5161 Long story short: color schemes and themes have different requirements.
   5162 Please do not conflate the two.
   5163 
   5164 ** Port the Modus themes to other platforms?
   5165 :properties:
   5166 :custom_id: h:7156b949-917d-488e-9a72-59f70d80729c
   5167 :end:
   5168 #+cindex: Porting the themes to other editors
   5169 
   5170 There is no plan to port the themes to other platforms or text editors.
   5171 I (Protesilaos) only use GNU Emacs and thus cannot maintain code that
   5172 targets software I am either not familiar with or am not using on a
   5173 daily basis.
   5174 
   5175 While it is possible to produce a simulacrum based on a given template,
   5176 doing so would run contrary to how this project is maintained where
   5177 details matter greatly.
   5178 
   5179 Each program has its own requirements so it won't always be
   5180 possible---or indeed desirable---to have 1:1 correspondence between
   5181 what applies to Emacs and what should be done elsewhere.  No port
   5182 should ever strive to be a copy of the Emacs implementation, as no
   5183 other program is an Emacs equivalent, but instead try to follow the
   5184 spirit of the design.  For example, some of the customization options
   5185 accept a list as their value, or an alist, which may not be possible
   5186 to reproduce on other platforms.
   5187 
   5188 [[#h:bf1c82f2-46c7-4eb2-ad00-dd11fdd8b53f][Customization options]].
   5189 
   5190 In other words, if something must be done differently on a certain
   5191 editor then that is acceptable so long as (i) the accessibility
   5192 standards are not compromised and (ii) the overall character of the
   5193 themes remains consistent.
   5194 
   5195 The former criterion should be crystal clear as it pertains to the
   5196 scientific foundations of the themes: high legibility and taking care
   5197 of the needs of users with red-green/blue-yellow color deficiency
   5198 (deuteranopia and tritanopia) by avoiding red+green color coding
   5199 paradigms and/or by providing yellow+blue variants for deuteranopia
   5200 and red+cyan for tritanopia ([[#h:f0f3dbcb-602d-40cf-b918-8f929c441baf][Overview]]).
   5201 
   5202 The latter criterion is the "je ne sais quoi" of the artistic aspect of
   5203 the themes, which is partially fleshed out in this manual.
   5204 
   5205 [[#h:b3384767-30d3-4484-ba7f-081729f03a47][Frequently Asked Questions]].
   5206 
   5207 With regard to the artistic aspect (where "art" qua skill may amount to
   5208 an imprecise science), there is no hard-and-fast rule in effect as it
   5209 requires one to exercize discretion and make decisions based on
   5210 context-dependent information or constraints.  As is true with most
   5211 things in life, when in doubt, do not cling on to the letter of the law
   5212 but try to understand its spirit.
   5213 
   5214 For a trivial example: the curly underline that Emacs draws for spelling
   5215 errors is thinner than, e.g., what a graphical web browser has, so if I
   5216 was to design for an editor than has a thicker curly underline I would
   5217 make the applicable colors less intense to counterbalance the
   5218 typographic intensity of the added thickness.
   5219 
   5220 With those granted, if anyone is willing to develop a port of the
   5221 themes, they are welcome to contact me and I will do my best to help
   5222 them in their efforts.
   5223 
   5224 * Contributing
   5225 :properties:
   5226 :custom_id: h:9c3cd842-14b7-44d7-84b2-a5c8bc3fc3b1
   5227 :end:
   5228 
   5229 This section documents the canonical sources of the themes and the ways
   5230 in which you can contribute to their ongoing development.
   5231 
   5232 ** Sources of the themes
   5233 :properties:
   5234 :custom_id: h:89504f1c-c9a1-4bd9-ab39-78fd0eddb47c
   5235 :end:
   5236 #+cindex: Sources of the themes
   5237 
   5238 + Package name (GNU ELPA): ~modus-themes~
   5239 + Official manual: <https://protesilaos.com/emacs/modus-themes>
   5240 + Change log: <https://protesilaos.com/emacs/modus-themes-changelog>
   5241 + Color palette: <https://protesilaos.com/emacs/modus-themes-colors>
   5242 + Sample pictures: <https://protesilaos.com/emacs/modus-themes-pictures>
   5243 + Git repo on SourceHut: <https://git.sr.ht/~protesilaos/modus-themes>
   5244   - Mirrors:
   5245     + GitHub: <https://github.com/protesilaos/modus-themes>
   5246     + GitLab: <https://gitlab.com/protesilaos/modus-themes>
   5247 + Mailing list: <https://lists.sr.ht/~protesilaos/modus-themes>
   5248 + Backronym: My Old Display Unexpectedly Sharpened ... themes
   5249 
   5250 ** Issues you can help with
   5251 :properties:
   5252 :custom_id: h:6536c8d5-3f98-43ab-a787-b94120e735e8
   5253 :end:
   5254 #+cindex: Contributing
   5255 
   5256 A few tasks you can help with by sending an email to the general
   5257 [[https://lists.sr.ht/~protesilaos/modus-themes][modus-themes public mailing list]].
   5258 
   5259 + Suggest refinements to packages that are covered.
   5260 + Report packages not covered thus far.
   5261 + Report bugs, inconsistencies, shortcomings.
   5262 + Help expand the documentation of covered-but-not-styled packages.
   5263 + Suggest refinements to the color palette.
   5264 + Help expand this document or any other piece of documentation.
   5265 + Send patches for code refinements (if you need, ask me for help with
   5266   Git---we all start out as beginners).
   5267 
   5268 [[#h:111773e2-f26f-4b68-8c4f-9794ca6b9633][Patches require copyright assignment to the FSF]].
   5269 
   5270 It is preferable that your feedback includes some screenshots, GIFs, or
   5271 short videos, as well as further instructions to reproduce a given
   5272 setup.  Though this is not a requirement.
   5273 
   5274 Whatever you do, bear in mind the overarching objective of the Modus
   5275 themes: to keep a contrast ratio that is greater or equal to 7:1 between
   5276 background and foreground colors.  If a compromise is ever necessary
   5277 between aesthetics and accessibility, it shall always be made in the
   5278 interest of the latter.
   5279 
   5280 ** Patches require copyright assignment to the FSF
   5281 :properties:
   5282 :custom_id: h:111773e2-f26f-4b68-8c4f-9794ca6b9633
   5283 :end:
   5284 
   5285 Code contributions are most welcome.  For any major edit (more than 15
   5286 lines, or so, in aggregate per person), you need to make a copyright
   5287 assignment to the Free Software Foundation.  This is necessary because
   5288 the themes are part of the upstream Emacs distribution: the FSF must at
   5289 all times be in a position to enforce the GNU General Public License.
   5290 
   5291 Copyright assignment is a simple process.  Check the request form below
   5292 (please adapt it accordingly).  You must write an email to the address
   5293 mentioned in the form and then wait for the FSF to send you a legal
   5294 agreement.  Sign the document and file it back to them.  This could all
   5295 happen via email and take about a week.  You are encouraged to go
   5296 through this process.  You only need to do it once.  It will allow you
   5297 to make contributions to Emacs in general.
   5298 
   5299 #+begin_example text
   5300 Please email the following information to assign@gnu.org, and we
   5301 will send you the assignment form for your past and future changes.
   5302 
   5303 Please use your full legal name (in ASCII characters) as the subject
   5304 line of the message.
   5305 
   5306 REQUEST: SEND FORM FOR PAST AND FUTURE CHANGES
   5307 
   5308 [What is the name of the program or package you're contributing to?]
   5309 
   5310 GNU Emacs
   5311 
   5312 [Did you copy any files or text written by someone else in these changes?
   5313 Even if that material is free software, we need to know about it.]
   5314 
   5315 Copied a few snippets from the same files I edited.  Their author,
   5316 Protesilaos Stavrou, has already assigned copyright to the Free Software
   5317 Foundation.
   5318 
   5319 [Do you have an employer who might have a basis to claim to own
   5320 your changes?  Do you attend a school which might make such a claim?]
   5321 
   5322 
   5323 [For the copyright registration, what country are you a citizen of?]
   5324 
   5325 
   5326 [What year were you born?]
   5327 
   5328 
   5329 [Please write your email address here.]
   5330 
   5331 
   5332 [Please write your postal address here.]
   5333 
   5334 
   5335 
   5336 
   5337 
   5338 [Which files have you changed so far, and which new files have you written
   5339 so far?]
   5340 
   5341 #+end_example
   5342 
   5343 * Acknowledgements
   5344 :properties:
   5345 :custom_id: h:95c3da23-217f-404e-b5f3-56c75760ebcf
   5346 :end:
   5347 #+cindex: Contributors
   5348 
   5349 The Modus themes are a collective effort.  Every bit of work matters.
   5350 
   5351 + Author/maintainer :: Protesilaos Stavrou.
   5352 
   5353 + Contributions to code or documentation :: Aleksei Gusev, Alex
   5354   Griffin, Anders Johansson, Antonio Ruiz, Basil L.{{{space()}}}
   5355   Contovounesios, Björn Lindström, Carlo Zancanaro, Christian Tietze,
   5356   Daniel Mendler, David Edmondson, Eli Zaretskii, Fritz Grabo, Gautier
   5357   Ponsinet, Illia Ostapyshyn, Kévin Le Gouguec, Koen van Greevenbroek,
   5358   Kostadin Ninev, Madhavan Krishnan, Manuel Giraud, Markus Beppler,
   5359   Matthew Stevenson, Mauro Aranda, Nacho Barrientos, Nicolas De
   5360   Jaeghere, Paul David, Philip Kaludercic, Pierre Téchoueyres, Rudolf
   5361   Adamkovič, Sergey Nichiporchik, Shreyas Ragavan, Stefan Kangas,
   5362   Stephen Berman, Stephen Gildea, Steve Downey, Tomasz Hołubowicz,
   5363   Utkarsh Singh, Vincent Murphy, Xinglu Chen, Yuanchen Xie, fluentpwn,
   5364   okamsn.
   5365 
   5366 + Ideas and user feedback :: Aaron Jensen, Adam Porter, Adam Spiers,
   5367   Adrian Manea, Aleksei Pirogov, Alex Griffin, Alex Koen, Alex
   5368   Peitsinis, Alexey Shmalko, Alok Singh, Anders Johansson, André
   5369   Alexandre Gomes, Andrew Tropin, Antonio Hernández Blas, Arif Rezai,
   5370   Augusto Stoffel, Basil L.{{{space()}}} Contovounesios, Bernd
   5371   Rellermeyer, Burgess Chang, Charlotte Van Petegem, Christian Tietze,
   5372   Christopher Dimech, Christopher League, Damien Cassou, Daniel
   5373   Mendler, Dario Gjorgjevski, David Edmondson, Davor Rotim, Divan
   5374   Santana, Eliraz Kedmi, Emanuele Michele Alberto Monterosso, Farasha
   5375   Euker, Feng Shu, Gautier Ponsinet, Gerry Agbobada, Gianluca Recchia,
   5376   Gonçalo Marrafa, Guilherme Semente, Gustavo Barros, Hörmetjan
   5377   Yiltiz, Ilja Kocken, Imran Khan, Iris Garcia, Ivan Popovych, James
   5378   Ferguson, Jeremy Friesen, Jerry Zhang, Johannes Grødem, John Haman,
   5379   Jonas Collberg, Jorge Morais, Joshua O'Connor, Julio C. Villasante,
   5380   Kenta Usami, Kevin Fleming, Kévin Le Gouguec, Kevin Kainan Li,
   5381   Kostadin Ninev, Laith Bahodi, Lasse Lindner, Len Trigg, Lennart
   5382   C. Karssen, Luis Miguel Castañeda, Magne Hov, Manuel Giraud, Manuel
   5383   Uberti, Mark Bestley, Mark Burton, Mark Simpson, Marko Kocic, Markus
   5384   Beppler, Matt Armstrong, Matthias Fuchs, Mattias Engdegård, Mauro
   5385   Aranda, Maxime Tréca, Michael Goldenberg, Morgan Smith, Morgan
   5386   Willcock, Murilo Pereira, Nicky van Foreest, Nicolas De Jaeghere,
   5387   Nicolas Semrau, Olaf Meeuwissen, Oliver Epper, Pablo Stafforini,
   5388   Paul Poloskov, Pengji Zhang, Pete Kazmier, Peter Wu, Philip
   5389   Kaludercic, Pierre Téchoueyres, Przemysław Kryger, Robert Hepple,
   5390   Roman Rudakov, Russell Sim, Ryan Phillips, Rytis Paškauskas, Rudolf
   5391   Adamkovič, Sam Kleinman, Samuel Culpepper, Saša Janiška, Shreyas
   5392   Ragavan, Simon Pugnet, Steve Downey, Tassilo Horn, Thanos Apollo,
   5393   Thibaut Verron, Thomas Heartman, Togan Muftuoglu, Tony Zorman, Trey
   5394   Merkley, Tomasz Hołubowicz, Toon Claes, Uri Sharf, Utkarsh Singh,
   5395   Vincent Foley, Zoltan Kiraly.  As well as users: Ben, CsBigDataHub1,
   5396   Emacs Contrib, Eugene, Fourchaux, Fredrik, Moesasji, Nick, Summer
   5397   Emacs, TheBlob42, TitusMu, Trey, bepolymathe, bit9tream,
   5398   bangedorrunt, derek-upham, doolio, fleimgruber, gitrj95, iSeeU,
   5399   jixiuf, okamsn, pRot0ta1p, soaringbird, tumashu, wakamenod.
   5400 
   5401 + Packaging :: Basil L.{{{space()}}} Contovounesios, Eli Zaretskii,
   5402   Glenn Morris, Mauro Aranda, Richard Stallman, Stefan Kangas (core
   5403   Emacs), Stefan Monnier (GNU Elpa), André Alexandre Gomes, Andrew
   5404   Tropin, Dimakakos Dimos, Morgan Smith, Nicolas Goaziou (Guix), Dhavan
   5405   Vaidya (Debian).
   5406 
   5407 + Inspiration for certain features :: Bozhidar Batsov (zenburn-theme),
   5408   Fabrice Niessen (leuven-theme).
   5409 
   5410 Special thanks (from A-Z) to Daniel Mendler, Gustavo Barros, Manuel
   5411 Uberti, Nicolas De Jaeghere, and Omar Antolín Camarena for their long
   5412 time contributions and insightful commentary on key aspects of the
   5413 themes' design and/or aspects of their functionality.
   5414 
   5415 All errors are my own.
   5416 
   5417 * GNU Free Documentation License
   5418 :properties:
   5419 :appendix: t
   5420 :custom_id: h:3077c3d2-7f90-4228-8f0a-73124f4026f6
   5421 :end:
   5422 
   5423 #+texinfo: @include doclicense.texi
   5424 
   5425 #+begin_export html
   5426 <pre>
   5427 
   5428                 GNU Free Documentation License
   5429                  Version 1.3, 3 November 2008
   5430 
   5431 
   5432  Copyright (C) 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
   5433      <https://fsf.org/>
   5434  Everyone is permitted to copy and distribute verbatim copies
   5435  of this license document, but changing it is not allowed.
   5436 
   5437 0. PREAMBLE
   5438 
   5439 The purpose of this License is to make a manual, textbook, or other
   5440 functional and useful document "free" in the sense of freedom: to
   5441 assure everyone the effective freedom to copy and redistribute it,
   5442 with or without modifying it, either commercially or noncommercially.
   5443 Secondarily, this License preserves for the author and publisher a way
   5444 to get credit for their work, while not being considered responsible
   5445 for modifications made by others.
   5446 
   5447 This License is a kind of "copyleft", which means that derivative
   5448 works of the document must themselves be free in the same sense.  It
   5449 complements the GNU General Public License, which is a copyleft
   5450 license designed for free software.
   5451 
   5452 We have designed this License in order to use it for manuals for free
   5453 software, because free software needs free documentation: a free
   5454 program should come with manuals providing the same freedoms that the
   5455 software does.  But this License is not limited to software manuals;
   5456 it can be used for any textual work, regardless of subject matter or
   5457 whether it is published as a printed book.  We recommend this License
   5458 principally for works whose purpose is instruction or reference.
   5459 
   5460 
   5461 1. APPLICABILITY AND DEFINITIONS
   5462 
   5463 This License applies to any manual or other work, in any medium, that
   5464 contains a notice placed by the copyright holder saying it can be
   5465 distributed under the terms of this License.  Such a notice grants a
   5466 world-wide, royalty-free license, unlimited in duration, to use that
   5467 work under the conditions stated herein.  The "Document", below,
   5468 refers to any such manual or work.  Any member of the public is a
   5469 licensee, and is addressed as "you".  You accept the license if you
   5470 copy, modify or distribute the work in a way requiring permission
   5471 under copyright law.
   5472 
   5473 A "Modified Version" of the Document means any work containing the
   5474 Document or a portion of it, either copied verbatim, or with
   5475 modifications and/or translated into another language.
   5476 
   5477 A "Secondary Section" is a named appendix or a front-matter section of
   5478 the Document that deals exclusively with the relationship of the
   5479 publishers or authors of the Document to the Document's overall
   5480 subject (or to related matters) and contains nothing that could fall
   5481 directly within that overall subject.  (Thus, if the Document is in
   5482 part a textbook of mathematics, a Secondary Section may not explain
   5483 any mathematics.)  The relationship could be a matter of historical
   5484 connection with the subject or with related matters, or of legal,
   5485 commercial, philosophical, ethical or political position regarding
   5486 them.
   5487 
   5488 The "Invariant Sections" are certain Secondary Sections whose titles
   5489 are designated, as being those of Invariant Sections, in the notice
   5490 that says that the Document is released under this License.  If a
   5491 section does not fit the above definition of Secondary then it is not
   5492 allowed to be designated as Invariant.  The Document may contain zero
   5493 Invariant Sections.  If the Document does not identify any Invariant
   5494 Sections then there are none.
   5495 
   5496 The "Cover Texts" are certain short passages of text that are listed,
   5497 as Front-Cover Texts or Back-Cover Texts, in the notice that says that
   5498 the Document is released under this License.  A Front-Cover Text may
   5499 be at most 5 words, and a Back-Cover Text may be at most 25 words.
   5500 
   5501 A "Transparent" copy of the Document means a machine-readable copy,
   5502 represented in a format whose specification is available to the
   5503 general public, that is suitable for revising the document
   5504 straightforwardly with generic text editors or (for images composed of
   5505 pixels) generic paint programs or (for drawings) some widely available
   5506 drawing editor, and that is suitable for input to text formatters or
   5507 for automatic translation to a variety of formats suitable for input
   5508 to text formatters.  A copy made in an otherwise Transparent file
   5509 format whose markup, or absence of markup, has been arranged to thwart
   5510 or discourage subsequent modification by readers is not Transparent.
   5511 An image format is not Transparent if used for any substantial amount
   5512 of text.  A copy that is not "Transparent" is called "Opaque".
   5513 
   5514 Examples of suitable formats for Transparent copies include plain
   5515 ASCII without markup, Texinfo input format, LaTeX input format, SGML
   5516 or XML using a publicly available DTD, and standard-conforming simple
   5517 HTML, PostScript or PDF designed for human modification.  Examples of
   5518 transparent image formats include PNG, XCF and JPG.  Opaque formats
   5519 include proprietary formats that can be read and edited only by
   5520 proprietary word processors, SGML or XML for which the DTD and/or
   5521 processing tools are not generally available, and the
   5522 machine-generated HTML, PostScript or PDF produced by some word
   5523 processors for output purposes only.
   5524 
   5525 The "Title Page" means, for a printed book, the title page itself,
   5526 plus such following pages as are needed to hold, legibly, the material
   5527 this License requires to appear in the title page.  For works in
   5528 formats which do not have any title page as such, "Title Page" means
   5529 the text near the most prominent appearance of the work's title,
   5530 preceding the beginning of the body of the text.
   5531 
   5532 The "publisher" means any person or entity that distributes copies of
   5533 the Document to the public.
   5534 
   5535 A section "Entitled XYZ" means a named subunit of the Document whose
   5536 title either is precisely XYZ or contains XYZ in parentheses following
   5537 text that translates XYZ in another language.  (Here XYZ stands for a
   5538 specific section name mentioned below, such as "Acknowledgements",
   5539 "Dedications", "Endorsements", or "History".)  To "Preserve the Title"
   5540 of such a section when you modify the Document means that it remains a
   5541 section "Entitled XYZ" according to this definition.
   5542 
   5543 The Document may include Warranty Disclaimers next to the notice which
   5544 states that this License applies to the Document.  These Warranty
   5545 Disclaimers are considered to be included by reference in this
   5546 License, but only as regards disclaiming warranties: any other
   5547 implication that these Warranty Disclaimers may have is void and has
   5548 no effect on the meaning of this License.
   5549 
   5550 2. VERBATIM COPYING
   5551 
   5552 You may copy and distribute the Document in any medium, either
   5553 commercially or noncommercially, provided that this License, the
   5554 copyright notices, and the license notice saying this License applies
   5555 to the Document are reproduced in all copies, and that you add no
   5556 other conditions whatsoever to those of this License.  You may not use
   5557 technical measures to obstruct or control the reading or further
   5558 copying of the copies you make or distribute.  However, you may accept
   5559 compensation in exchange for copies.  If you distribute a large enough
   5560 number of copies you must also follow the conditions in section 3.
   5561 
   5562 You may also lend copies, under the same conditions stated above, and
   5563 you may publicly display copies.
   5564 
   5565 
   5566 3. COPYING IN QUANTITY
   5567 
   5568 If you publish printed copies (or copies in media that commonly have
   5569 printed covers) of the Document, numbering more than 100, and the
   5570 Document's license notice requires Cover Texts, you must enclose the
   5571 copies in covers that carry, clearly and legibly, all these Cover
   5572 Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
   5573 the back cover.  Both covers must also clearly and legibly identify
   5574 you as the publisher of these copies.  The front cover must present
   5575 the full title with all words of the title equally prominent and
   5576 visible.  You may add other material on the covers in addition.
   5577 Copying with changes limited to the covers, as long as they preserve
   5578 the title of the Document and satisfy these conditions, can be treated
   5579 as verbatim copying in other respects.
   5580 
   5581 If the required texts for either cover are too voluminous to fit
   5582 legibly, you should put the first ones listed (as many as fit
   5583 reasonably) on the actual cover, and continue the rest onto adjacent
   5584 pages.
   5585 
   5586 If you publish or distribute Opaque copies of the Document numbering
   5587 more than 100, you must either include a machine-readable Transparent
   5588 copy along with each Opaque copy, or state in or with each Opaque copy
   5589 a computer-network location from which the general network-using
   5590 public has access to download using public-standard network protocols
   5591 a complete Transparent copy of the Document, free of added material.
   5592 If you use the latter option, you must take reasonably prudent steps,
   5593 when you begin distribution of Opaque copies in quantity, to ensure
   5594 that this Transparent copy will remain thus accessible at the stated
   5595 location until at least one year after the last time you distribute an
   5596 Opaque copy (directly or through your agents or retailers) of that
   5597 edition to the public.
   5598 
   5599 It is requested, but not required, that you contact the authors of the
   5600 Document well before redistributing any large number of copies, to
   5601 give them a chance to provide you with an updated version of the
   5602 Document.
   5603 
   5604 
   5605 4. MODIFICATIONS
   5606 
   5607 You may copy and distribute a Modified Version of the Document under
   5608 the conditions of sections 2 and 3 above, provided that you release
   5609 the Modified Version under precisely this License, with the Modified
   5610 Version filling the role of the Document, thus licensing distribution
   5611 and modification of the Modified Version to whoever possesses a copy
   5612 of it.  In addition, you must do these things in the Modified Version:
   5613 
   5614 A. Use in the Title Page (and on the covers, if any) a title distinct
   5615    from that of the Document, and from those of previous versions
   5616    (which should, if there were any, be listed in the History section
   5617    of the Document).  You may use the same title as a previous version
   5618    if the original publisher of that version gives permission.
   5619 B. List on the Title Page, as authors, one or more persons or entities
   5620    responsible for authorship of the modifications in the Modified
   5621    Version, together with at least five of the principal authors of the
   5622    Document (all of its principal authors, if it has fewer than five),
   5623    unless they release you from this requirement.
   5624 C. State on the Title page the name of the publisher of the
   5625    Modified Version, as the publisher.
   5626 D. Preserve all the copyright notices of the Document.
   5627 E. Add an appropriate copyright notice for your modifications
   5628    adjacent to the other copyright notices.
   5629 F. Include, immediately after the copyright notices, a license notice
   5630    giving the public permission to use the Modified Version under the
   5631    terms of this License, in the form shown in the Addendum below.
   5632 G. Preserve in that license notice the full lists of Invariant Sections
   5633    and required Cover Texts given in the Document's license notice.
   5634 H. Include an unaltered copy of this License.
   5635 I. Preserve the section Entitled "History", Preserve its Title, and add
   5636    to it an item stating at least the title, year, new authors, and
   5637    publisher of the Modified Version as given on the Title Page.  If
   5638    there is no section Entitled "History" in the Document, create one
   5639    stating the title, year, authors, and publisher of the Document as
   5640    given on its Title Page, then add an item describing the Modified
   5641    Version as stated in the previous sentence.
   5642 J. Preserve the network location, if any, given in the Document for
   5643    public access to a Transparent copy of the Document, and likewise
   5644    the network locations given in the Document for previous versions
   5645    it was based on.  These may be placed in the "History" section.
   5646    You may omit a network location for a work that was published at
   5647    least four years before the Document itself, or if the original
   5648    publisher of the version it refers to gives permission.
   5649 K. For any section Entitled "Acknowledgements" or "Dedications",
   5650    Preserve the Title of the section, and preserve in the section all
   5651    the substance and tone of each of the contributor acknowledgements
   5652    and/or dedications given therein.
   5653 L. Preserve all the Invariant Sections of the Document,
   5654    unaltered in their text and in their titles.  Section numbers
   5655    or the equivalent are not considered part of the section titles.
   5656 M. Delete any section Entitled "Endorsements".  Such a section
   5657    may not be included in the Modified Version.
   5658 N. Do not retitle any existing section to be Entitled "Endorsements"
   5659    or to conflict in title with any Invariant Section.
   5660 O. Preserve any Warranty Disclaimers.
   5661 
   5662 If the Modified Version includes new front-matter sections or
   5663 appendices that qualify as Secondary Sections and contain no material
   5664 copied from the Document, you may at your option designate some or all
   5665 of these sections as invariant.  To do this, add their titles to the
   5666 list of Invariant Sections in the Modified Version's license notice.
   5667 These titles must be distinct from any other section titles.
   5668 
   5669 You may add a section Entitled "Endorsements", provided it contains
   5670 nothing but endorsements of your Modified Version by various
   5671 parties--for example, statements of peer review or that the text has
   5672 been approved by an organization as the authoritative definition of a
   5673 standard.
   5674 
   5675 You may add a passage of up to five words as a Front-Cover Text, and a
   5676 passage of up to 25 words as a Back-Cover Text, to the end of the list
   5677 of Cover Texts in the Modified Version.  Only one passage of
   5678 Front-Cover Text and one of Back-Cover Text may be added by (or
   5679 through arrangements made by) any one entity.  If the Document already
   5680 includes a cover text for the same cover, previously added by you or
   5681 by arrangement made by the same entity you are acting on behalf of,
   5682 you may not add another; but you may replace the old one, on explicit
   5683 permission from the previous publisher that added the old one.
   5684 
   5685 The author(s) and publisher(s) of the Document do not by this License
   5686 give permission to use their names for publicity for or to assert or
   5687 imply endorsement of any Modified Version.
   5688 
   5689 
   5690 5. COMBINING DOCUMENTS
   5691 
   5692 You may combine the Document with other documents released under this
   5693 License, under the terms defined in section 4 above for modified
   5694 versions, provided that you include in the combination all of the
   5695 Invariant Sections of all of the original documents, unmodified, and
   5696 list them all as Invariant Sections of your combined work in its
   5697 license notice, and that you preserve all their Warranty Disclaimers.
   5698 
   5699 The combined work need only contain one copy of this License, and
   5700 multiple identical Invariant Sections may be replaced with a single
   5701 copy.  If there are multiple Invariant Sections with the same name but
   5702 different contents, make the title of each such section unique by
   5703 adding at the end of it, in parentheses, the name of the original
   5704 author or publisher of that section if known, or else a unique number.
   5705 Make the same adjustment to the section titles in the list of
   5706 Invariant Sections in the license notice of the combined work.
   5707 
   5708 In the combination, you must combine any sections Entitled "History"
   5709 in the various original documents, forming one section Entitled
   5710 "History"; likewise combine any sections Entitled "Acknowledgements",
   5711 and any sections Entitled "Dedications".  You must delete all sections
   5712 Entitled "Endorsements".
   5713 
   5714 
   5715 6. COLLECTIONS OF DOCUMENTS
   5716 
   5717 You may make a collection consisting of the Document and other
   5718 documents released under this License, and replace the individual
   5719 copies of this License in the various documents with a single copy
   5720 that is included in the collection, provided that you follow the rules
   5721 of this License for verbatim copying of each of the documents in all
   5722 other respects.
   5723 
   5724 You may extract a single document from such a collection, and
   5725 distribute it individually under this License, provided you insert a
   5726 copy of this License into the extracted document, and follow this
   5727 License in all other respects regarding verbatim copying of that
   5728 document.
   5729 
   5730 
   5731 7. AGGREGATION WITH INDEPENDENT WORKS
   5732 
   5733 A compilation of the Document or its derivatives with other separate
   5734 and independent documents or works, in or on a volume of a storage or
   5735 distribution medium, is called an "aggregate" if the copyright
   5736 resulting from the compilation is not used to limit the legal rights
   5737 of the compilation's users beyond what the individual works permit.
   5738 When the Document is included in an aggregate, this License does not
   5739 apply to the other works in the aggregate which are not themselves
   5740 derivative works of the Document.
   5741 
   5742 If the Cover Text requirement of section 3 is applicable to these
   5743 copies of the Document, then if the Document is less than one half of
   5744 the entire aggregate, the Document's Cover Texts may be placed on
   5745 covers that bracket the Document within the aggregate, or the
   5746 electronic equivalent of covers if the Document is in electronic form.
   5747 Otherwise they must appear on printed covers that bracket the whole
   5748 aggregate.
   5749 
   5750 
   5751 8. TRANSLATION
   5752 
   5753 Translation is considered a kind of modification, so you may
   5754 distribute translations of the Document under the terms of section 4.
   5755 Replacing Invariant Sections with translations requires special
   5756 permission from their copyright holders, but you may include
   5757 translations of some or all Invariant Sections in addition to the
   5758 original versions of these Invariant Sections.  You may include a
   5759 translation of this License, and all the license notices in the
   5760 Document, and any Warranty Disclaimers, provided that you also include
   5761 the original English version of this License and the original versions
   5762 of those notices and disclaimers.  In case of a disagreement between
   5763 the translation and the original version of this License or a notice
   5764 or disclaimer, the original version will prevail.
   5765 
   5766 If a section in the Document is Entitled "Acknowledgements",
   5767 "Dedications", or "History", the requirement (section 4) to Preserve
   5768 its Title (section 1) will typically require changing the actual
   5769 title.
   5770 
   5771 
   5772 9. TERMINATION
   5773 
   5774 You may not copy, modify, sublicense, or distribute the Document
   5775 except as expressly provided under this License.  Any attempt
   5776 otherwise to copy, modify, sublicense, or distribute it is void, and
   5777 will automatically terminate your rights under this License.
   5778 
   5779 However, if you cease all violation of this License, then your license
   5780 from a particular copyright holder is reinstated (a) provisionally,
   5781 unless and until the copyright holder explicitly and finally
   5782 terminates your license, and (b) permanently, if the copyright holder
   5783 fails to notify you of the violation by some reasonable means prior to
   5784 60 days after the cessation.
   5785 
   5786 Moreover, your license from a particular copyright holder is
   5787 reinstated permanently if the copyright holder notifies you of the
   5788 violation by some reasonable means, this is the first time you have
   5789 received notice of violation of this License (for any work) from that
   5790 copyright holder, and you cure the violation prior to 30 days after
   5791 your receipt of the notice.
   5792 
   5793 Termination of your rights under this section does not terminate the
   5794 licenses of parties who have received copies or rights from you under
   5795 this License.  If your rights have been terminated and not permanently
   5796 reinstated, receipt of a copy of some or all of the same material does
   5797 not give you any rights to use it.
   5798 
   5799 
   5800 10. FUTURE REVISIONS OF THIS LICENSE
   5801 
   5802 The Free Software Foundation may publish new, revised versions of the
   5803 GNU Free Documentation License from time to time.  Such new versions
   5804 will be similar in spirit to the present version, but may differ in
   5805 detail to address new problems or concerns.  See
   5806 https://www.gnu.org/licenses/.
   5807 
   5808 Each version of the License is given a distinguishing version number.
   5809 If the Document specifies that a particular numbered version of this
   5810 License "or any later version" applies to it, you have the option of
   5811 following the terms and conditions either of that specified version or
   5812 of any later version that has been published (not as a draft) by the
   5813 Free Software Foundation.  If the Document does not specify a version
   5814 number of this License, you may choose any version ever published (not
   5815 as a draft) by the Free Software Foundation.  If the Document
   5816 specifies that a proxy can decide which future versions of this
   5817 License can be used, that proxy's public statement of acceptance of a
   5818 version permanently authorizes you to choose that version for the
   5819 Document.
   5820 
   5821 11. RELICENSING
   5822 
   5823 "Massive Multiauthor Collaboration Site" (or "MMC Site") means any
   5824 World Wide Web server that publishes copyrightable works and also
   5825 provides prominent facilities for anybody to edit those works.  A
   5826 public wiki that anybody can edit is an example of such a server.  A
   5827 "Massive Multiauthor Collaboration" (or "MMC") contained in the site
   5828 means any set of copyrightable works thus published on the MMC site.
   5829 
   5830 "CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0
   5831 license published by Creative Commons Corporation, a not-for-profit
   5832 corporation with a principal place of business in San Francisco,
   5833 California, as well as future copyleft versions of that license
   5834 published by that same organization.
   5835 
   5836 "Incorporate" means to publish or republish a Document, in whole or in
   5837 part, as part of another Document.
   5838 
   5839 An MMC is "eligible for relicensing" if it is licensed under this
   5840 License, and if all works that were first published under this License
   5841 somewhere other than this MMC, and subsequently incorporated in whole or
   5842 in part into the MMC, (1) had no cover texts or invariant sections, and
   5843 (2) were thus incorporated prior to November 1, 2008.
   5844 
   5845 The operator of an MMC Site may republish an MMC contained in the site
   5846 under CC-BY-SA on the same site at any time before August 1, 2009,
   5847 provided the MMC is eligible for relicensing.
   5848 
   5849 
   5850 ADDENDUM: How to use this License for your documents
   5851 
   5852 To use this License in a document you have written, include a copy of
   5853 the License in the document and put the following copyright and
   5854 license notices just after the title page:
   5855 
   5856     Copyright (c)  YEAR  YOUR NAME.
   5857     Permission is granted to copy, distribute and/or modify this document
   5858     under the terms of the GNU Free Documentation License, Version 1.3
   5859     or any later version published by the Free Software Foundation;
   5860     with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
   5861     A copy of the license is included in the section entitled "GNU
   5862     Free Documentation License".
   5863 
   5864 If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
   5865 replace the "with...Texts." line with this:
   5866 
   5867     with the Invariant Sections being LIST THEIR TITLES, with the
   5868     Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST.
   5869 
   5870 If you have Invariant Sections without Cover Texts, or some other
   5871 combination of the three, merge those two alternatives to suit the
   5872 situation.
   5873 
   5874 If your document contains nontrivial examples of program code, we
   5875 recommend releasing these examples in parallel under your choice of
   5876 free software license, such as the GNU General Public License,
   5877 to permit their use in free software.
   5878 </pre>
   5879 #+end_export
   5880 
   5881 #+html: <!--
   5882 
   5883 * Indices
   5884 :properties:
   5885 :custom_id: h:55104b26-8e94-46cf-9975-43ea00316489
   5886 :end:
   5887 
   5888 ** Function index
   5889 :properties:
   5890 :index: fn
   5891 :custom_id: h:6bec5005-529c-4521-ae05-3d990baffb5b
   5892 :end:
   5893 
   5894 ** Variable index
   5895 :properties:
   5896 :index: vr
   5897 :custom_id: h:16ad8df6-b015-40a9-9259-03d4f7a23ee4
   5898 :end:
   5899 
   5900 ** Concept index
   5901 :properties:
   5902 :index: cp
   5903 :custom_id: h:6aa7a656-884b-4c39-b759-087e412eec13
   5904 :end:
   5905 
   5906 #+html: -->