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