Compare commits

...

No commits in common. "0.7.0" and "main" have entirely different histories.
0.7.0 ... main

19 changed files with 34845 additions and 6249 deletions

4
.dir-locals.el Normal file
View file

@ -0,0 +1,4 @@
;;; Directory Local Variables
;;; For more information see (info "(emacs) Directory Variables")
((emacs-lisp-mode . ((indent-tabs-mode . nil))))

5
.gitignore vendored Normal file
View file

@ -0,0 +1,5 @@
*.elc
*-autoloads.el
*-pkg.el
doc/fdl-1.3.txt
doc/modus-themes.texi

File diff suppressed because it is too large Load diff

View file

@ -632,7 +632,7 @@ state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
modus-themes
Copyright (C) 2019 Protesilaos Stavrou
Copyright (C) 2019-2023 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -652,7 +652,7 @@ Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
modus-themes Copyright (C) 2019 Protesilaos Stavrou
modus-themes Copyright (C) 2019-2023 Free Software Foundation, Inc.
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.

137
README.md Normal file
View file

@ -0,0 +1,137 @@
# Modus themes for GNU Emacs
IMAGES HERE: <https://protesilaos.com/emacs/modus-themes-pictures>.
Highly accessible themes, conforming with the highest standard for
colour contrast between background and foreground values (WCAG AAA).
They also are optimised for users with red-green colour deficiency.
The themes are very customisable and provide support for a very wide
range of packages. Their manual is detailed so that new users can get
started, while it also provides custom code for all sorts of more
advanced customisations.
Since August 2020, the original Modus themes (`modus-operandi`,
`modus-vivendi`) are built into Emacs version 28 or higher. Emacs 28
ships with `modus-themes` version `1.6.0`. Emacs 29 includes version
`3.0.0`. Emacs 30 provides a newer, refactored version that
thoroughly refashions how the themes are implemented and customized.
Such major versions are not backward-compatible due to the limited
resources at my disposal to support multiple versions of Emacs and of
the themes across the years.
Starting with version `5.0.0` of the `modus-themes`, other packages
can be built on top to provide their own "Modus" derivative themes.
The manual has a section about building on top of Modus. My
`ef-themes` and `standard-themes` are done in this way (versions
`2.0.0` and `3.0.0`, respectively).
+ Package name (GNU ELPA): `modus-themes`
+ Official manual: <https://protesilaos.com/emacs/modus-themes>
+ Change log: <https://protesilaos.com/emacs/modus-themes-changelog>
+ Colour palette: <https://protesilaos.com/emacs/modus-themes-colors>
+ Sample pictures: <https://protesilaos.com/emacs/modus-themes-pictures>
+ Git repositories:
+ GitHub: <https://github.com/protesilaos/modus-themes>
+ GitLab: <https://gitlab.com/protesilaos/modus-themes>
+ Backronym: My Old Display Unexpectedly Sharpened ... themes.
```elisp
(use-package modus-themes
:ensure t
:demand t
:init
;; Starting with version 5.0.0 of the `modus-themes', other packages
;; can be built on top to provide their own "Modus" derivatives.
;; For example, this is what I do with my `ef-themes' and
;; `standard-themes' (starting with versions 2.0.0 and 3.0.0,
;; respectively).
;;
;; The `modus-themes-include-derivatives-mode' makes all Modus
;; commands that act on a theme consider all such derivatives, if
;; their respective packages are available and have been loaded.
;;
;; Note that those packages can even completely take over from the
;; Modus themes such that, for example, `modus-themes-rotate' only
;; goes through the Ef themes (to this end, the Ef themes provide
;; the `ef-themes-take-over-modus-themes-mode' and the Standard
;; themes have the `standard-themes-take-over-modus-themes-mode'
;; equivalent).
;;
;; If you only care about the Modus themes, then (i) you do not need
;; to enable the `modus-themes-include-derivatives-mode' and (ii) do
;; not install and activate those other theme packages.
(modus-themes-include-derivatives-mode 1)
:bind
(("<f5>" . modus-themes-rotate)
("C-<f5>" . modus-themes-select)
("M-<f5>" . modus-themes-load-random))
:config
;; Your customizations here. All customizations must evaluated
;; BEFORE loading the theme.
(setq modus-themes-to-toggle '(modus-operandi modus-vivendi)
modus-themes-to-rotate modus-themes-items
modus-themes-mixed-fonts t
modus-themes-variable-pitch-ui t
modus-themes-italic-constructs t
modus-themes-bold-constructs t
modus-themes-completions '((t . (bold)))
modus-themes-prompts '(bold)
modus-themes-headings
'((agenda-structure . (variable-pitch light 2.2))
(agenda-date . (variable-pitch regular 1.3))
(t . (regular 1.15))))
(setq modus-themes-common-palette-overrides nil)
;; Finally, load your theme of choice (or a random one with
;; `modus-themes-load-random', `modus-themes-load-random-dark',
;; `modus-themes-load-random-light').
(modus-themes-load-theme 'modus-operandi))
```
## Links to other projects
In this section I collect links to other themes built on top of Modus,
have Modus as a dependency, or are porting Modus to some other
platform. You are welcome to append your project to the relevant list.
In linking to these projects, I am not endorsing anybody's views.
### Emacs themes based on Modus
This is not an exhaustive list. You are welcome to add your package
here. Newer projects are at the bottom and are added as I am made
aware of them.
- `ef-themes` by Protesilaos <https://github.com/protesilaos/ef-themes>
- `standard-themes` by Protesilaos <https://github.com/protesilaos/standard-themes>
- `modus-ewal-theme` by Oliwier Czerwiński <https://github.com/deadendpl/modus-ewal-theme>
- `modus-flexoki` by Derek Passen <https://github.com/dpassen/modus-flexoki>
- `faff-theme` (since version 4) by James Ferguson <https://github.com/WJCFerguson/emacs-faff-theme>
- `modus-catpuccin` by Magnus Therning <https://gitlab.com/magus/modus-catppuccin>
- `pixel-themes` by Lucas <https://github.com/lucasobx/pixel-themes>
- `modus-nordic` (`modus-nordic-night` and `modus-nordic-midnight`) by Ashton Wiersdorf <https://codeberg.org/ashton314/modus-nordic-night>
- `folio-theme` by kn66 (nobu43) <https://github.com/kn66/folio-theme.el>
- `modus-alabaster` by Derek Passen <https://github.com/dpassen/modus-alabaster>
- `modus-vague` by Ashish Panigrahi <https://github.com/paniash/modus-vague.git>
- `peppers-theme` by Joar von Arndt <https://codeberg.org/joar/peppers-theme>
### Other Emacs packages based on Modus
- `modus-themes-exporter` by Protesilaos <https://github.com/protesilaos/modus-themes-exporter>
### Projects inspired by the Modus themes
This is not an exhaustive list. You are welcome to add your project here.
- `hugo-modus` by Yejun Su is a theme for the Hugo static site
generator: <https://github.com/goofansu/hugo-modus>. It uses colours
from the Modus themes.
- `modus-themes.nvim` by Miika Nissi and others is a port for NeoVim:
<https://github.com/miikanissi/modus-themes.nvim>.
- `zed-modus-themes` by Vitaly Slobodin is a port for the Zed editor:
<https://github.com/vitallium/zed-modus-themes>.
- `word-smith` by Sadsnake1 is a distraction-free writing for Obsidian
that includes ports of the Modus themes: <https://github.com/Sadsnake1/word-smith>
- `omarchy-modus-themes` by Dhavan Vaidya: <https://github.com/codingquark/omarchy-modus-themes>

View file

@ -1,544 +0,0 @@
#+TITLE: Modus Themes for GNU Emacs
#+AUTHOR: Protesilaos Stavrou
#+EMAIL: public@protesilaos.com
* Overview
:PROPERTIES:
:CUSTOM_ID: h:d42d56a4-9252-4858-ac8e-3306cdd24e19
:END:
This is a set of accessible themes for GNU Emacs. The contrast ratio
between foreground and background values should always be >= 7:1, which
conforms with the WCAG AAA accessibility standard. This is the highest
standard of its kind.
The /Modus themes/ project consists of two standalone items, one where
dark text is cast on a light backdrop (Modus Operandi) and another where
light text is displayed against a dark background (Modus Vivendi).
*Check the [[https://gitlab.com/protesilaos/modus-themes/wikis/Screenshots][Wiki page with the screen shots]].* Also note that I demo these
themes in [[https://protesilaos.com/code-casts][my Emacs-related screen casts]] (though older videos contain
earlier, "alpha" versions).
* Install and auto-load
:PROPERTIES:
:CUSTOM_ID: h:25c3ecd3-8025-414c-9b96-e4d6266c6fe8
:END:
** Install the packages
:PROPERTIES:
:CUSTOM_ID: h:c3e293e8-8464-4196-aefd-184027116ded
:END:
I maintain /Modus Operandi/ (light theme) and /Modus Vivendi/ (dark) as
standalone packages in ELPA, MELPA, and MELPA Stable.
Just run:
=M-x package-install RET modus-operandi-theme RET=
And/or:
=M-x package-install RET modus-vivendi-theme RET=
To be clear, that sequence means:
+ press `Meta-X'
+ type `package-install'
+ hit the Return key
+ type the name of the package
+ hit Return to confirm your choice
*** With `use-package'
:PROPERTIES:
:CUSTOM_ID: h:3ab0ac39-38fb-405b-8a15-771cbd843b6d
:END:
For a declarative approach with =use-package=, you can write something
like this:
#+BEGIN_SRC emacs-lisp
(use-package modus-operandi-theme
:ensure t)
(use-package modus-vivendi-theme
:ensure t)
#+END_SRC
** Manual installation method
:PROPERTIES:
:CUSTOM_ID: h:0317c29a-3ddb-4a0a-8ffd-16c781733ea2
:END:
Download the files in this repository ending in =*-theme.el= and place
them in an appropriate directory, such as =~/.emacs.d/themes/=. To make
sure the filesystem path of your choice is read by Emacs, insert the
following in your initialisation file:
#+BEGIN_SRC emacs-lisp
(add-to-list 'custom-theme-load-path "~/.emacs.d/themes/")
#+END_SRC
** Load automatically
:PROPERTIES:
:CUSTOM_ID: h:ae978e05-526f-4509-a007-44a0925b8bce
:END:
To load the theme from your Emacs initialisation file use the relevant
snippet:
#+BEGIN_SRC emacs-lisp
(load-theme 'modus-operandi t) ; Light theme
(load-theme 'modus-vivendi t) ; Dark theme
#+END_SRC
Make sure to /remove any other theme/ that is being loaded, otherwise
you might run into unexpected issues.
* Customisation options
:PROPERTIES:
:CUSTOM_ID: h:d414ca47-6dce-4905-9f2e-de1465bf23bb
:END:
Both of the Modus themes expose some variables that allow users to tweak
the look of the theme. By default, all variables are deactivated,
meaning that *you need to explicitly opt in*.
This is what is available right now (use the ones appropriate to the
theme of your choice):
#+BEGIN_SRC emacs-lisp
;; Choose to render more code constructs in slanted text (italics). The
;; default, shown below, is to not use italics, unless it is absolutely
;; necessary.
(setq modus-operandi-theme-slanted-constructs nil)
(setq modus-vivendi-theme-slanted-constructs nil)
;; Opt to display some additional code constructs in bold. The default,
;; shown below, is to use bold weight only where necessary.
(setq modus-operandi-theme-bold-constructs nil)
(setq modus-vivendi-theme-bold-constructs nil)
;; Use proportionately-spaced fonts (variable-pitch) for headings. The
;; default is to use whatever font the user has selected, typically a
;; monospaced typeface.
(setq modus-operandi-theme-proportional-fonts nil)
(setq modus-vivendi-theme-proportional-fonts nil)
;; Whether headings should be scaled or have the same height as body
;; text. The default is to keep everything the same as the base size.
(setq modus-operandi-theme-scale-headings nil)
(setq modus-vivendi-theme-scale-headings nil)
;; Font scale that should apply to headings. These are the default values.
(setq modus-operandi-theme-scale-1 1.05)
(setq modus-operandi-theme-scale-2 1.1)
(setq modus-operandi-theme-scale-3 1.15)
(setq modus-operandi-theme-scale-4 1.2)
(setq modus-vivendi-theme-scale-1 1.05)
(setq modus-vivendi-theme-scale-2 1.1)
(setq modus-vivendi-theme-scale-3 1.15)
(setq modus-vivendi-theme-scale-4 1.2)
;; Make the fringes visible. This renders them in a different
;; background than the main buffer.
(setq modus-operandi-theme-visible-fringes nil)
(setq modus-vivendi-theme-visible-fringes nil)
;; Use a distinct background for Org's source blocks and extend their
;; headings until the edge of the window (the "extend" part is for Emacs
;; versions >= 27, whereas before they would extend anyhow). The
;; default is to use the same background as the rest of the buffer,
;; while beginning and end lines do not extend to the end of the window
;; (again, the extend is for Emacs 27 or higher).
(setq modus-operandi-theme-distinct-org-blocks nil)
(setq modus-vivendi-theme-distinct-org-blocks nil)
#+END_SRC
*NOTE* that all customisation options must be declared /before/ loading
the theme, else they will not be parsed and have no effect.
* Face coverage
:PROPERTIES:
:CUSTOM_ID: h:944a3bdf-f545-40a0-a26c-b2cec8b2b316
:END:
This list will always be updated to reflect the current state of the
project. The idea is to offer an overview of the /known status/ of all
affected face groups.
** Full support
:PROPERTIES:
:CUSTOM_ID: h:5ea98392-1376-43a4-8080-2d42a5b690ef
:END:
The items with an appended asterisk =*= tend to have lots of extensions, so
the "full support" may not be 100% true…
+ ace-window
+ alert
+ all-the-icons
+ annotate
+ anzu
+ apropos
+ apt-sources-list
+ artbollocks-mode
+ auctex and TeX
+ auto-dim-other-buffers
+ avy
+ bm
+ breakpoint (provided by built-in gdb-mi.el)
+ buffer-expose
+ calendar and diary
+ calfw
+ centaur-tabs
+ change-log and log-view (=vc-print-log= and =vc-print-root-log=)
+ cider
+ column-enforce-mode
+ company-mode*
+ company-posframe
+ compilation-mode
+ completions
+ counsel*
+ counsel-css
+ counsel-notmuch
+ counsel-org-capture-string
+ cov
+ custom (=M-x customize=)
+ dap-mode
+ dashboard (emacs-dashboard)
+ deadgrep
+ define-word
+ deft
+ diff-hl
+ diff-mode
+ dim-autoload
+ dired
+ dired-async
+ dired-git
+ dired-git-info
+ dired-narrow
+ dired-subtree
+ diredfl
+ disk-usage
+ doom-modeline
+ dynamic-ruler
+ easy-jekyll
+ easy-kill
+ ebdb
+ ediff
+ eldoc-box
+ elfeed
+ elfeed-score
+ emms
+ enhanced-ruby-mode
+ epa
+ equake
+ erc
+ ert
+ eshell
+ evil* (evil-mode)
+ evil-goggles
+ evil-visual-mark-mode
+ eww
+ eyebrowse
+ fancy-dabbrev
+ flycheck
+ flycheck-indicator
+ flycheck-posframe
+ flymake
+ flyspell
+ flyspell-correct
+ freeze-it
+ frog-menu
+ focus
+ fold-this
+ font-lock (generic syntax highlighting)
+ fountain (fountain-mode)
+ geiser
+ git
+ git-gutter (and variants)
+ git-lens
+ git-timemachine
+ git-walktree
+ gnus
+ helm* (also see [[#h:e4408911-e186-4825-bd4f-4d0ea55cd6d6][section below on Helm's grep-related functions]])
+ helm-ls-git
+ helm-switch-shell
+ helm-xref
+ highlight-blocks
+ highlight-defined
+ highlight-escape-sequences (=hes-mode=)
+ highlight-numbers
+ highlight-thing
+ hl-fill-column
+ hl-line-mode
+ hl-todo
+ hydra
+ ido-mode
+ iedit
+ imenu-list
+ info
+ info-colors
+ interaction-log
+ ioccur
+ isearch, occur, etc.
+ ivy*
+ ivy-posframe
+ jira (org-jira)
+ js2-mode
+ julia
+ jupyter
+ kaocha-runner
+ keycast
+ line numbers (=display-line-numbers-mode= and global variant)
+ lsp-mode
+ lsp-ui
+ magit
+ markdown-mode
+ markup-faces (=adoc-mode=)
+ mentor
+ messages
+ modeline
+ mood-line
+ mu4e
+ mu4e-conversation
+ multiple-cursors
+ neotree
+ num3-mode
+ org*
+ org-journal
+ org-noter
+ org-pomodoro
+ org-recur
+ org-roam
+ org-superstar
+ org-treescope
+ origami
+ outline-mode
+ outline-minor-faces
+ package (=M-x list-packages=)
+ paradox
+ paren-face
+ pass
+ persp-mode
+ perspective
+ powerline
+ powerline-evil
+ proced
+ prodigy
+ rainbow-blocks
+ rainbow-identifiers
+ rainbow-delimiters
+ regexp-builder (also known as =re-builder=)
+ rg (rg.el)
+ ripgrep
+ rmail
+ ruler-mode
+ sallet
+ selectrum
+ sesman
+ shell-script-mode
+ show-paren-mode
+ side-notes
+ skewer-mode
+ smart-mode-line
+ smartparens
+ smerge
+ speedbar
+ stripes
+ suggest
+ swiper
+ sx
+ symbol-overlay
+ syslog-mode
+ telephone-line
+ term
+ transient (pop-up windows like Magit's)
+ treemacs
+ undo-tree
+ vc (built-in mode line status for version control)
+ vc-annotate (=C-x v g=)
+ visual-regexp
+ volatile-highlights
+ web-mode
+ wgrep
+ which-function-mode
+ which-key
+ whitespace-mode
+ window-divider-mode
+ writegood-mode
+ xah-elisp-mode
+ xref
+ xterm-color (and ansi-colors)
+ yaml-mode
+ ztree
Plus many other miscellaneous faces that are provided by the out-of-the-box
Emacs distribution.
** Covered but not styled explicitly
:PROPERTIES:
:CUSTOM_ID: h:8ada963d-046d-4c67-becf-eee18595f902
:END:
These do not require any extra styles because they are configured to
inherit from some basic faces. Please confirm.
+ comint
+ bongo
+ edit-indirect
** Help needed
:PROPERTIES:
:CUSTOM_ID: h:bcc3f6f9-7ace-4e2a-8dbb-2bf55574dae5
:END:
These are face groups that I am aware of but do not know how to access
or do not actively use. I generally need to see how a face looks in its
context before assessing its aesthetics or specific requirements.
Use =M-x list-faces-display= to get these.
+ tty-menu
Note that the themes do provide support for =org-mode=, but some of
these interfaces have been decided based on indirect experience. If you
encounter anything that does not "feel right", please let me know.
** Will NOT be supported
:PROPERTIES:
:CUSTOM_ID: h:46756fcc-0d85-4f77-b0e3-64f890e1c2ea
:END:
I have thus far identified a single package that does fit into the
overarching objective of this project: [[https://github.com/hlissner/emacs-solaire-mode][solaire]]. It basically tries to
cast a less intense background on the main file-visiting buffers, so
that secondary elements like sidebars can have the default (pure
white/black) background.
/I will only support this package if it ever supports the inverse
effect/: less intense colours (but still accessible) for supportive
interfaces and the intended styles for the content you are actually
working on.
** Note for HELM users of grep or grep-like functions
:PROPERTIES:
:CUSTOM_ID: h:e4408911-e186-4825-bd4f-4d0ea55cd6d6
:END:
There is one face from the Helm package that is meant to highlight the
matches of a grep or grep-like command (=ag= or =ripgrep=). It is
=helm-grep-match=. However, this face can only apply when the user does
not pass =--color=always= as a command-line option for their command.
Here is the docstring for that face, which is defined in the
=helm-grep.el= library (view a library with =M-x find-library=).
#+begin_quote
Face used to highlight grep matches. Have no effect when grep backend
use "--color="
#+end_quote
The user must either remove =--color= from the flags passed to the grep
function, or explicitly use =--color=never= (or equivalent). Helm
provides user-facing customisation options for controlling the grep
function's parameters, such as =helm-grep-default-command= and
=helm-grep-git-grep-command=.
When =--color=always= is in effect, the grep output will use red text in
bold letter forms to present the matching part in the list of
candidates. *That style still meets the contrast ratio target of >= 7:1*
(accessibility standard WCAG AAA), because it draws the reference to
ANSI colour number 1 (red) from the already-supported array of
=ansi-color-names-vector=.
I presented [[https://gitlab.com/protesilaos/modus-themes/-/issues/21#note_302748582][some screen shots of this in issue 21]].
** Note on VC-ANNOTATE-BACKGROUND-MODE
:PROPERTIES:
:CUSTOM_ID: h:5b5d4420-50cc-4d53-a9f8-825cba6b68f1
:END:
Due to the unique way =vc-annotate= (=C-x v g=) applies colours, support for
its background mode (=vc-annotate-background-mode=) is disabled at the
theme level.
Normally, such a drastic measure should not belong in a theme: assuming
the user's preferences is bad practice. However, it has been deemed
necessary in the interest of preserving colour contrast accessibility
while still supporting a useful built-in tool.
If there actually is a way to avoid such a course of action, without
prejudice to the accessibility standard of this project, then please
report as much (or contribute as per the information in the [[#h:25ba8d6f-6604-4338-b774-bbe531d467f6][Contributing]]
section).
* Contributing
:PROPERTIES:
:CUSTOM_ID: h:25ba8d6f-6604-4338-b774-bbe531d467f6
:END:
A few tasks you can help me with, sorted from the most probable to the
least likely:
+ Suggest refinements to packages that are covered.
+ Report packages not covered thus far.
+ Report bugs, inconsistencies, shortcomings.
+ Help expand the documentation of covered-but-not-styled packages.
+ Suggest refinements to the colour palette.
+ Help expand this document or any other piece of documentation.
It would be great if your feedback also includes some screenshots, GIFs,
or short videos. Though this is not a requirement.
Whatever you do, please bear in mind the overarching objective of the
Modus themes: to keep a contrast ratio that is greater or equal to 7:1
between background and foreground colours. If a compromise is ever
necessary between aesthetics and accessibility, it shall always be made
in the interest of the latter.
** Code contributions require copyright assignment to the FSF
:PROPERTIES:
:CUSTOM_ID: h:d3fb2fc7-6c34-4e68-b2d6-6048849b0319
:END:
I accept code contributions as well (send merge requests!). But for any
major contribution (more than 15 lines, or so), you need to make a
copyright assignment to the Free Software Foundation. This is necessary
because the themes are distributed through the official GNU ELPA
repository and the FSF must be in a position to enforce the GNU General
Public License.
Copyright assignment /is a simple process/ that I had to follow as well.
Check the [[https://git.savannah.gnu.org/cgit/gnulib.git/tree/doc/Copyright/request-assign.future][request form]]. You must send an email to the address mentioned
in the form and then wait for the FSF to send you a legal agreement.
Sign the document and file it back to them. This should all happen via
email and take about a week.
I encourage you to go through this process. You only need to do it
once. It will allow you to make contributions to Emacs in general.
* Meta
:PROPERTIES:
:CUSTOM_ID: h:4c338a51-509e-42c0-8820-1f5014fb477b
:END:
If you interested in the principles that govern the development of this
project, read my article [[https://protesilaos.com/codelog/2020-03-17-design-modus-themes-emacs/][On the design of the Modus themes]] (2020-03-17).
* COPYING
:PROPERTIES:
:CUSTOM_ID: h:66652183-2fe0-46cd-b4bb-4121bad78d57
:END:
The Modus Themes are distributed under the terms of the GNU General
Public License version 3 or, at your choice, any later version. See the
COPYING file distributed in the [[https://gitlab.com/protesilaos/modus-themes][project's Git repository]].

505
doc/doclicense.texi Normal file
View file

@ -0,0 +1,505 @@
@c The GNU Free Documentation License.
@center Version 1.3, 3 November 2008
@c This file is intended to be included within another document,
@c hence no sectioning command or @node.
@display
Copyright @copyright{} 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
@uref{https://fsf.org/}
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
@end display
@enumerate 0
@item
PREAMBLE
The purpose of this License is to make a manual, textbook, or other
functional and useful document @dfn{free} in the sense of freedom: to
assure everyone the effective freedom to copy and redistribute it,
with or without modifying it, either commercially or noncommercially.
Secondarily, this License preserves for the author and publisher a way
to get credit for their work, while not being considered responsible
for modifications made by others.
This License is a kind of ``copyleft'', which means that derivative
works of the document must themselves be free in the same sense. It
complements the GNU General Public License, which is a copyleft
license designed for free software.
We have designed this License in order to use it for manuals for free
software, because free software needs free documentation: a free
program should come with manuals providing the same freedoms that the
software does. But this License is not limited to software manuals;
it can be used for any textual work, regardless of subject matter or
whether it is published as a printed book. We recommend this License
principally for works whose purpose is instruction or reference.
@item
APPLICABILITY AND DEFINITIONS
This License applies to any manual or other work, in any medium, that
contains a notice placed by the copyright holder saying it can be
distributed under the terms of this License. Such a notice grants a
world-wide, royalty-free license, unlimited in duration, to use that
work under the conditions stated herein. The ``Document'', below,
refers to any such manual or work. Any member of the public is a
licensee, and is addressed as ``you''. You accept the license if you
copy, modify or distribute the work in a way requiring permission
under copyright law.
A ``Modified Version'' of the Document means any work containing the
Document or a portion of it, either copied verbatim, or with
modifications and/or translated into another language.
A ``Secondary Section'' is a named appendix or a front-matter section
of the Document that deals exclusively with the relationship of the
publishers or authors of the Document to the Document's overall
subject (or to related matters) and contains nothing that could fall
directly within that overall subject. (Thus, if the Document is in
part a textbook of mathematics, a Secondary Section may not explain
any mathematics.) The relationship could be a matter of historical
connection with the subject or with related matters, or of legal,
commercial, philosophical, ethical or political position regarding
them.
The ``Invariant Sections'' are certain Secondary Sections whose titles
are designated, as being those of Invariant Sections, in the notice
that says that the Document is released under this License. If a
section does not fit the above definition of Secondary then it is not
allowed to be designated as Invariant. The Document may contain zero
Invariant Sections. If the Document does not identify any Invariant
Sections then there are none.
The ``Cover Texts'' are certain short passages of text that are listed,
as Front-Cover Texts or Back-Cover Texts, in the notice that says that
the Document is released under this License. A Front-Cover Text may
be at most 5 words, and a Back-Cover Text may be at most 25 words.
A ``Transparent'' copy of the Document means a machine-readable copy,
represented in a format whose specification is available to the
general public, that is suitable for revising the document
straightforwardly with generic text editors or (for images composed of
pixels) generic paint programs or (for drawings) some widely available
drawing editor, and that is suitable for input to text formatters or
for automatic translation to a variety of formats suitable for input
to text formatters. A copy made in an otherwise Transparent file
format whose markup, or absence of markup, has been arranged to thwart
or discourage subsequent modification by readers is not Transparent.
An image format is not Transparent if used for any substantial amount
of text. A copy that is not ``Transparent'' is called ``Opaque''.
Examples of suitable formats for Transparent copies include plain
ASCII without markup, Texinfo input format, La@TeX{} input
format, SGML or XML using a publicly available
DTD, and standard-conforming simple HTML,
PostScript or PDF designed for human modification. Examples
of transparent image formats include PNG, XCF and
JPG@. Opaque formats include proprietary formats that can be
read and edited only by proprietary word processors, SGML or
XML for which the DTD and/or processing tools are
not generally available, and the machine-generated HTML,
PostScript or PDF produced by some word processors for
output purposes only.
The ``Title Page'' means, for a printed book, the title page itself,
plus such following pages as are needed to hold, legibly, the material
this License requires to appear in the title page. For works in
formats which do not have any title page as such, ``Title Page'' means
the text near the most prominent appearance of the work's title,
preceding the beginning of the body of the text.
The ``publisher'' means any person or entity that distributes copies
of the Document to the public.
A section ``Entitled XYZ'' means a named subunit of the Document whose
title either is precisely XYZ or contains XYZ in parentheses following
text that translates XYZ in another language. (Here XYZ stands for a
specific section name mentioned below, such as ``Acknowledgements'',
``Dedications'', ``Endorsements'', or ``History''.) To ``Preserve the Title''
of such a section when you modify the Document means that it remains a
section ``Entitled XYZ'' according to this definition.
The Document may include Warranty Disclaimers next to the notice which
states that this License applies to the Document. These Warranty
Disclaimers are considered to be included by reference in this
License, but only as regards disclaiming warranties: any other
implication that these Warranty Disclaimers may have is void and has
no effect on the meaning of this License.
@item
VERBATIM COPYING
You may copy and distribute the Document in any medium, either
commercially or noncommercially, provided that this License, the
copyright notices, and the license notice saying this License applies
to the Document are reproduced in all copies, and that you add no other
conditions whatsoever to those of this License. You may not use
technical measures to obstruct or control the reading or further
copying of the copies you make or distribute. However, you may accept
compensation in exchange for copies. If you distribute a large enough
number of copies you must also follow the conditions in section 3.
You may also lend copies, under the same conditions stated above, and
you may publicly display copies.
@item
COPYING IN QUANTITY
If you publish printed copies (or copies in media that commonly have
printed covers) of the Document, numbering more than 100, and the
Document's license notice requires Cover Texts, you must enclose the
copies in covers that carry, clearly and legibly, all these Cover
Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
the back cover. Both covers must also clearly and legibly identify
you as the publisher of these copies. The front cover must present
the full title with all words of the title equally prominent and
visible. You may add other material on the covers in addition.
Copying with changes limited to the covers, as long as they preserve
the title of the Document and satisfy these conditions, can be treated
as verbatim copying in other respects.
If the required texts for either cover are too voluminous to fit
legibly, you should put the first ones listed (as many as fit
reasonably) on the actual cover, and continue the rest onto adjacent
pages.
If you publish or distribute Opaque copies of the Document numbering
more than 100, you must either include a machine-readable Transparent
copy along with each Opaque copy, or state in or with each Opaque copy
a computer-network location from which the general network-using
public has access to download using public-standard network protocols
a complete Transparent copy of the Document, free of added material.
If you use the latter option, you must take reasonably prudent steps,
when you begin distribution of Opaque copies in quantity, to ensure
that this Transparent copy will remain thus accessible at the stated
location until at least one year after the last time you distribute an
Opaque copy (directly or through your agents or retailers) of that
edition to the public.
It is requested, but not required, that you contact the authors of the
Document well before redistributing any large number of copies, to give
them a chance to provide you with an updated version of the Document.
@item
MODIFICATIONS
You may copy and distribute a Modified Version of the Document under
the conditions of sections 2 and 3 above, provided that you release
the Modified Version under precisely this License, with the Modified
Version filling the role of the Document, thus licensing distribution
and modification of the Modified Version to whoever possesses a copy
of it. In addition, you must do these things in the Modified Version:
@enumerate A
@item
Use in the Title Page (and on the covers, if any) a title distinct
from that of the Document, and from those of previous versions
(which should, if there were any, be listed in the History section
of the Document). You may use the same title as a previous version
if the original publisher of that version gives permission.
@item
List on the Title Page, as authors, one or more persons or entities
responsible for authorship of the modifications in the Modified
Version, together with at least five of the principal authors of the
Document (all of its principal authors, if it has fewer than five),
unless they release you from this requirement.
@item
State on the Title page the name of the publisher of the
Modified Version, as the publisher.
@item
Preserve all the copyright notices of the Document.
@item
Add an appropriate copyright notice for your modifications
adjacent to the other copyright notices.
@item
Include, immediately after the copyright notices, a license notice
giving the public permission to use the Modified Version under the
terms of this License, in the form shown in the Addendum below.
@item
Preserve in that license notice the full lists of Invariant Sections
and required Cover Texts given in the Document's license notice.
@item
Include an unaltered copy of this License.
@item
Preserve the section Entitled ``History'', Preserve its Title, and add
to it an item stating at least the title, year, new authors, and
publisher of the Modified Version as given on the Title Page. If
there is no section Entitled ``History'' in the Document, create one
stating the title, year, authors, and publisher of the Document as
given on its Title Page, then add an item describing the Modified
Version as stated in the previous sentence.
@item
Preserve the network location, if any, given in the Document for
public access to a Transparent copy of the Document, and likewise
the network locations given in the Document for previous versions
it was based on. These may be placed in the ``History'' section.
You may omit a network location for a work that was published at
least four years before the Document itself, or if the original
publisher of the version it refers to gives permission.
@item
For any section Entitled ``Acknowledgements'' or ``Dedications'', Preserve
the Title of the section, and preserve in the section all the
substance and tone of each of the contributor acknowledgements and/or
dedications given therein.
@item
Preserve all the Invariant Sections of the Document,
unaltered in their text and in their titles. Section numbers
or the equivalent are not considered part of the section titles.
@item
Delete any section Entitled ``Endorsements''. Such a section
may not be included in the Modified Version.
@item
Do not retitle any existing section to be Entitled ``Endorsements'' or
to conflict in title with any Invariant Section.
@item
Preserve any Warranty Disclaimers.
@end enumerate
If the Modified Version includes new front-matter sections or
appendices that qualify as Secondary Sections and contain no material
copied from the Document, you may at your option designate some or all
of these sections as invariant. To do this, add their titles to the
list of Invariant Sections in the Modified Version's license notice.
These titles must be distinct from any other section titles.
You may add a section Entitled ``Endorsements'', provided it contains
nothing but endorsements of your Modified Version by various
parties---for example, statements of peer review or that the text has
been approved by an organization as the authoritative definition of a
standard.
You may add a passage of up to five words as a Front-Cover Text, and a
passage of up to 25 words as a Back-Cover Text, to the end of the list
of Cover Texts in the Modified Version. Only one passage of
Front-Cover Text and one of Back-Cover Text may be added by (or
through arrangements made by) any one entity. If the Document already
includes a cover text for the same cover, previously added by you or
by arrangement made by the same entity you are acting on behalf of,
you may not add another; but you may replace the old one, on explicit
permission from the previous publisher that added the old one.
The author(s) and publisher(s) of the Document do not by this License
give permission to use their names for publicity for or to assert or
imply endorsement of any Modified Version.
@item
COMBINING DOCUMENTS
You may combine the Document with other documents released under this
License, under the terms defined in section 4 above for modified
versions, provided that you include in the combination all of the
Invariant Sections of all of the original documents, unmodified, and
list them all as Invariant Sections of your combined work in its
license notice, and that you preserve all their Warranty Disclaimers.
The combined work need only contain one copy of this License, and
multiple identical Invariant Sections may be replaced with a single
copy. If there are multiple Invariant Sections with the same name but
different contents, make the title of each such section unique by
adding at the end of it, in parentheses, the name of the original
author or publisher of that section if known, or else a unique number.
Make the same adjustment to the section titles in the list of
Invariant Sections in the license notice of the combined work.
In the combination, you must combine any sections Entitled ``History''
in the various original documents, forming one section Entitled
``History''; likewise combine any sections Entitled ``Acknowledgements'',
and any sections Entitled ``Dedications''. You must delete all
sections Entitled ``Endorsements.''
@item
COLLECTIONS OF DOCUMENTS
You may make a collection consisting of the Document and other documents
released under this License, and replace the individual copies of this
License in the various documents with a single copy that is included in
the collection, provided that you follow the rules of this License for
verbatim copying of each of the documents in all other respects.
You may extract a single document from such a collection, and distribute
it individually under this License, provided you insert a copy of this
License into the extracted document, and follow this License in all
other respects regarding verbatim copying of that document.
@item
AGGREGATION WITH INDEPENDENT WORKS
A compilation of the Document or its derivatives with other separate
and independent documents or works, in or on a volume of a storage or
distribution medium, is called an ``aggregate'' if the copyright
resulting from the compilation is not used to limit the legal rights
of the compilation's users beyond what the individual works permit.
When the Document is included in an aggregate, this License does not
apply to the other works in the aggregate which are not themselves
derivative works of the Document.
If the Cover Text requirement of section 3 is applicable to these
copies of the Document, then if the Document is less than one half of
the entire aggregate, the Document's Cover Texts may be placed on
covers that bracket the Document within the aggregate, or the
electronic equivalent of covers if the Document is in electronic form.
Otherwise they must appear on printed covers that bracket the whole
aggregate.
@item
TRANSLATION
Translation is considered a kind of modification, so you may
distribute translations of the Document under the terms of section 4.
Replacing Invariant Sections with translations requires special
permission from their copyright holders, but you may include
translations of some or all Invariant Sections in addition to the
original versions of these Invariant Sections. You may include a
translation of this License, and all the license notices in the
Document, and any Warranty Disclaimers, provided that you also include
the original English version of this License and the original versions
of those notices and disclaimers. In case of a disagreement between
the translation and the original version of this License or a notice
or disclaimer, the original version will prevail.
If a section in the Document is Entitled ``Acknowledgements'',
``Dedications'', or ``History'', the requirement (section 4) to Preserve
its Title (section 1) will typically require changing the actual
title.
@item
TERMINATION
You may not copy, modify, sublicense, or distribute the Document
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense, or distribute it is void, and
will automatically terminate your rights under this License.
However, if you cease all violation of this License, then your license
from a particular copyright holder is reinstated (a) provisionally,
unless and until the copyright holder explicitly and finally
terminates your license, and (b) permanently, if the copyright holder
fails to notify you of the violation by some reasonable means prior to
60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, receipt of a copy of some or all of the same material does
not give you any rights to use it.
@item
FUTURE REVISIONS OF THIS LICENSE
The Free Software Foundation may publish new, revised versions
of the GNU Free Documentation License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns. See
@uref{https://www.gnu.org/licenses/}.
Each version of the License is given a distinguishing version number.
If the Document specifies that a particular numbered version of this
License ``or any later version'' applies to it, you have the option of
following the terms and conditions either of that specified version or
of any later version that has been published (not as a draft) by the
Free Software Foundation. If the Document does not specify a version
number of this License, you may choose any version ever published (not
as a draft) by the Free Software Foundation. If the Document
specifies that a proxy can decide which future versions of this
License can be used, that proxy's public statement of acceptance of a
version permanently authorizes you to choose that version for the
Document.
@item
RELICENSING
``Massive Multiauthor Collaboration Site'' (or ``MMC Site'') means any
World Wide Web server that publishes copyrightable works and also
provides prominent facilities for anybody to edit those works. A
public wiki that anybody can edit is an example of such a server. A
``Massive Multiauthor Collaboration'' (or ``MMC'') contained in the
site means any set of copyrightable works thus published on the MMC
site.
``CC-BY-SA'' means the Creative Commons Attribution-Share Alike 3.0
license published by Creative Commons Corporation, a not-for-profit
corporation with a principal place of business in San Francisco,
California, as well as future copyleft versions of that license
published by that same organization.
``Incorporate'' means to publish or republish a Document, in whole or
in part, as part of another Document.
An MMC is ``eligible for relicensing'' if it is licensed under this
License, and if all works that were first published under this License
somewhere other than this MMC, and subsequently incorporated in whole
or in part into the MMC, (1) had no cover texts or invariant sections,
and (2) were thus incorporated prior to November 1, 2008.
The operator of an MMC Site may republish an MMC contained in the site
under CC-BY-SA on the same site at any time before August 1, 2009,
provided the MMC is eligible for relicensing.
@end enumerate
@page
@heading ADDENDUM: How to use this License for your documents
To use this License in a document you have written, include a copy of
the License in the document and put the following copyright and
license notices just after the title page:
@smallexample
@group
Copyright (C) @var{year} @var{your name}.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
Texts. A copy of the license is included in the section entitled ``GNU
Free Documentation License''.
@end group
@end smallexample
If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
replace the ``with@dots{}Texts.''@: line with this:
@smallexample
@group
with the Invariant Sections being @var{list their titles}, with
the Front-Cover Texts being @var{list}, and with the Back-Cover Texts
being @var{list}.
@end group
@end smallexample
If you have Invariant Sections without Cover Texts, or some other
combination of the three, merge those two alternatives to suit the
situation.
If your document contains nontrivial examples of program code, we
recommend releasing these examples in parallel under your choice of
free software license, such as the GNU General Public License,
to permit their use in free software.
@c Local Variables:
@c ispell-local-pdict: "ispell-dict"
@c End:

7520
doc/modus-themes.info Normal file

File diff suppressed because it is too large Load diff

6947
doc/modus-themes.org Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,95 @@
;;; modus-operandi-deuteranopia-theme.el --- Deuteranopia-optimized theme with a white background -*- lexical-binding:t -*-
;; Copyright (C) 2019-2026 Free Software Foundation, Inc.
;; Author: Protesilaos <info@protesilaos.com>
;; Maintainer: Protesilaos <info@protesilaos.com>
;; URL: https://github.com/protesilaos/modus-themes
;; Keywords: faces, theme, accessibility
;; This file is part of GNU Emacs.
;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;;
;; The Modus themes conform with the highest standard for
;; color-contrast accessibility between background and foreground
;; values (WCAG AAA). They are also highly customizable and can even
;; be used as the basis for other themes. Please refer to the official
;; Info manual for further documentation (distributed with the themes,
;; or available at: <https://protesilaos.com/emacs/modus-themes>).
;;; Code:
(unless (and (fboundp 'require-theme)
load-file-name
(equal (file-name-directory load-file-name)
(expand-file-name "themes/" data-directory))
(require-theme 'modus-themes t))
(require 'modus-themes))
(defcustom modus-operandi-deuteranopia-palette-user nil
"Like the `modus-operandi-deuteranopia-palette' for user-defined entries.
This is meant to extend the palette with custom named colors and/or
semantic palette mappings. Those may then be used in combination with
palette overrides (also see `modus-themes-common-palette-overrides' and
`modus-operandi-deuteranopia-palette-overrides')."
:group 'modus-themes
:package-version '(modus-themes . "4.5.0")
:type '(repeat (list symbol (choice symbol string)))
:link '(info-link "(modus-themes) Option to extend the palette for use with overrides"))
(defcustom modus-operandi-deuteranopia-palette-overrides nil
"Overrides for `modus-operandi-deuteranopia-palette'.
Mirror the elements of the aforementioned palette, overriding
their value.
For overrides that are shared across all of the Modus themes,
refer to `modus-themes-common-palette-overrides'.
Theme-specific overrides take precedence over shared overrides.
The idea of common overrides is to change semantic color
mappings, such as to make the cursor red. Wherea theme-specific
overrides can also be used to change the value of a named color,
such as what hexadecimal RGB value the red-warmer symbol
represents."
:group 'modus-themes
:package-version '(modus-themes . "4.0.0")
:version "30.1"
:type '(repeat (list symbol (choice symbol string)))
:link '(info-link "(modus-themes) Palette overrides"))
(modus-themes-theme
'modus-operandi-deuteranopia
'modus-themes
"Deuteranopia-optimized theme with a white background.
This variant is optimized for users with red-green color
deficiency (deuteranopia). It conforms with the highest
legibility standard for color contrast between background and
foreground in any given piece of text, which corresponds to a
minimum contrast in relative luminance of 7:1 (WCAG AAA
standard)."
'light
'modus-themes-operandi-deuteranopia-palette
'modus-operandi-deuteranopia-palette-user
'modus-operandi-deuteranopia-palette-overrides
'modus-themes-faces-deuteranopia)
(provide 'modus-operandi-deuteranopia-theme)
;;; modus-operandi-deuteranopia-theme.el ends here

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,92 @@
;;; modus-operandi-tinted-theme.el --- Elegant, highly legible theme with a light ochre background -*- lexical-binding:t -*-
;; Copyright (C) 2019-2026 Free Software Foundation, Inc.
;; Author: Protesilaos <info@protesilaos.com>
;; Maintainer: Protesilaos <info@protesilaos.com>
;; URL: https://github.com/protesilaos/modus-themes
;; Keywords: faces, theme, accessibility
;; This file is part of GNU Emacs.
;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;;
;; The Modus themes conform with the highest standard for
;; color-contrast accessibility between background and foreground
;; values (WCAG AAA). They are also highly customizable and can even
;; be used as the basis for other themes. Please refer to the official
;; Info manual for further documentation (distributed with the themes,
;; or available at: <https://protesilaos.com/emacs/modus-themes>).
;;; Code:
(unless (and (fboundp 'require-theme)
load-file-name
(equal (file-name-directory load-file-name)
(expand-file-name "themes/" data-directory))
(require-theme 'modus-themes t))
(require 'modus-themes))
(defcustom modus-operandi-tinted-palette-user nil
"Like the `modus-operandi-tinted-palette' for user-defined entries.
This is meant to extend the palette with custom named colors and/or
semantic palette mappings. Those may then be used in combination with
palette overrides (also see `modus-themes-common-palette-overrides' and
`modus-operandi-tinted-palette-overrides')."
:group 'modus-themes
:package-version '(modus-themes . "4.5.0")
:type '(repeat (list symbol (choice symbol string)))
:link '(info-link "(modus-themes) Option to extend the palette for use with overrides"))
(defcustom modus-operandi-tinted-palette-overrides nil
"Overrides for `modus-operandi-tinted-palette'.
Mirror the elements of the aforementioned palette, overriding
their value.
For overrides that are shared across all of the Modus themes,
refer to `modus-themes-common-palette-overrides'.
Theme-specific overrides take precedence over shared overrides.
The idea of common overrides is to change semantic color
mappings, such as to make the cursor red. Wherea theme-specific
overrides can also be used to change the value of a named color,
such as what hexadecimal RGB value the red-warmer symbol
represents."
:group 'modus-themes
:package-version '(modus-themes . "4.0.0")
:version "30.1"
:type '(repeat (list symbol (choice symbol string)))
:link '(info-link "(modus-themes) Palette overrides"))
(modus-themes-theme
'modus-operandi-tinted
'modus-themes
"Elegant, highly legible theme with a light ochre background.
Conforms with the highest legibility standard for color contrast
between background and foreground in any given piece of text,
which corresponds to a minimum contrast in relative luminance of
7:1 (WCAG AAA standard)."
'light
'modus-themes-operandi-tinted-palette
'modus-operandi-tinted-palette-user
'modus-operandi-tinted-palette-overrides)
(provide 'modus-operandi-tinted-theme)
;;; modus-operandi-tinted-theme.el ends here

View file

@ -0,0 +1,95 @@
;;; modus-operandi-tritanopia-theme.el --- Tritanopia-optimized theme with a white background -*- lexical-binding:t -*-
;; Copyright (C) 2019-2026 Free Software Foundation, Inc.
;; Author: Protesilaos <info@protesilaos.com>
;; Maintainer: Protesilaos <info@protesilaos.com>
;; URL: https://github.com/protesilaos/modus-themes
;; Keywords: faces, theme, accessibility
;; This file is part of GNU Emacs.
;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;;
;; The Modus themes conform with the highest standard for
;; color-contrast accessibility between background and foreground
;; values (WCAG AAA). They are also highly customizable and can even
;; be used as the basis for other themes. Please refer to the official
;; Info manual for further documentation (distributed with the themes,
;; or available at: <https://protesilaos.com/emacs/modus-themes>).
;;; Code:
(unless (and (fboundp 'require-theme)
load-file-name
(equal (file-name-directory load-file-name)
(expand-file-name "themes/" data-directory))
(require-theme 'modus-themes t))
(require 'modus-themes))
(defcustom modus-operandi-tritanopia-palette-user nil
"Like the `modus-operandi-tritanopia-palette' for user-defined entries.
This is meant to extend the palette with custom named colors and/or
semantic palette mappings. Those may then be used in combination with
palette overrides (also see `modus-themes-common-palette-overrides' and
`modus-operandi-tritanopia-palette-overrides')."
:group 'modus-themes
:package-version '(modus-themes . "4.5.0")
:type '(repeat (list symbol (choice symbol string)))
:link '(info-link "(modus-themes) Option to extend the palette for use with overrides"))
(defcustom modus-operandi-tritanopia-palette-overrides nil
"Overrides for `modus-operandi-tritanopia-palette'.
Mirror the elements of the aforementioned palette, overriding
their value.
For overrides that are shared across all of the Modus themes,
refer to `modus-themes-common-palette-overrides'.
Theme-specific overrides take precedence over shared overrides.
The idea of common overrides is to change semantic color
mappings, such as to make the cursor red. Wherea theme-specific
overrides can also be used to change the value of a named color,
such as what hexadecimal RGB value the red-warmer symbol
represents."
:group 'modus-themes
:package-version '(modus-themes . "4.0.0")
:version "30.1"
:type '(repeat (list symbol (choice symbol string)))
:link '(info-link "(modus-themes) Palette overrides"))
(modus-themes-theme
'modus-operandi-tritanopia
'modus-themes
"Tritanopia-optimized theme with a white background.
This variant is optimized for users with blue-yellow color
deficiency (tritanopia). It conforms with the highest
legibility standard for color contrast between background and
foreground in any given piece of text, which corresponds to a
minimum contrast in relative luminance of 7:1 (WCAG AAA
standard)."
'light
'modus-themes-operandi-tritanopia-palette
'modus-operandi-tritanopia-palette-user
'modus-operandi-tritanopia-palette-overrides
'modus-themes-faces-tritanopia)
(provide 'modus-operandi-tritanopia-theme)
;;; modus-operandi-tritanopia-theme.el ends here

7933
modus-themes.el Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,95 @@
;;; modus-vivendi-deuteranopia-theme.el --- Deuteranopia-optimized theme with a black background -*- lexical-binding:t -*-
;; Copyright (C) 2019-2026 Free Software Foundation, Inc.
;; Author: Protesilaos <info@protesilaos.com>
;; Maintainer: Protesilaos <info@protesilaos.com>
;; URL: https://github.com/protesilaos/modus-themes
;; Keywords: faces, theme, accessibility
;; This file is part of GNU Emacs.
;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;;
;; The Modus themes conform with the highest standard for
;; color-contrast accessibility between background and foreground
;; values (WCAG AAA). They are also highly customizable and can even
;; be used as the basis for other themes. Please refer to the official
;; Info manual for further documentation (distributed with the themes,
;; or available at: <https://protesilaos.com/emacs/modus-themes>).
;;; Code:
(unless (and (fboundp 'require-theme)
load-file-name
(equal (file-name-directory load-file-name)
(expand-file-name "themes/" data-directory))
(require-theme 'modus-themes t))
(require 'modus-themes))
(defcustom modus-vivendi-deuteranopia-palette-user nil
"Like the `modus-vivendi-deuteranopia-palette' for user-defined entries.
This is meant to extend the palette with custom named colors and/or
semantic palette mappings. Those may then be used in combination with
palette overrides (also see `modus-themes-common-palette-overrides' and
`modus-vivendi-deuteranopia-palette-overrides')."
:group 'modus-themes
:package-version '(modus-themes . "4.5.0")
:type '(repeat (list symbol (choice symbol string)))
:link '(info-link "(modus-themes) Option to extend the palette for use with overrides"))
(defcustom modus-vivendi-deuteranopia-palette-overrides nil
"Overrides for `modus-vivendi-deuteranopia-palette'.
Mirror the elements of the aforementioned palette, overriding
their value.
For overrides that are shared across all of the Modus themes,
refer to `modus-themes-common-palette-overrides'.
Theme-specific overrides take precedence over shared overrides.
The idea of common overrides is to change semantic color
mappings, such as to make the cursor red. Wherea theme-specific
overrides can also be used to change the value of a named color,
such as what hexadecimal RGB value the red-warmer symbol
represents."
:group 'modus-themes
:package-version '(modus-themes . "4.0.0")
:version "30.1"
:type '(repeat (list symbol (choice symbol string)))
:link '(info-link "(modus-themes) Palette overrides"))
(modus-themes-theme
'modus-vivendi-deuteranopia
'modus-themes
"Deuteranopia-optimized theme with a black background.
This variant is optimized for users with red-green color
deficiency (deuteranopia). It conforms with the highest
legibility standard for color contrast between background and
foreground in any given piece of text, which corresponds to a
minimum contrast in relative luminance of 7:1 (WCAG AAA
standard)."
'dark
'modus-themes-vivendi-deuteranopia-palette
'modus-vivendi-deuteranopia-palette-user
'modus-vivendi-deuteranopia-palette-overrides
'modus-themes-faces-deuteranopia)
(provide 'modus-vivendi-deuteranopia-theme)
;;; modus-vivendi-deuteranopia-theme.el ends here

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,92 @@
;;; modus-vivendi-tinted-theme.el --- Elegant, highly legible theme with a night sky background -*- lexical-binding:t -*-
;; Copyright (C) 2019-2026 Free Software Foundation, Inc.
;; Author: Protesilaos <info@protesilaos.com>
;; Maintainer: Protesilaos <info@protesilaos.com>
;; URL: https://github.com/protesilaos/modus-themes
;; Keywords: faces, theme, accessibility
;; This file is part of GNU Emacs.
;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;;
;; The Modus themes conform with the highest standard for
;; color-contrast accessibility between background and foreground
;; values (WCAG AAA). They are also highly customizable and can even
;; be used as the basis for other themes. Please refer to the official
;; Info manual for further documentation (distributed with the themes,
;; or available at: <https://protesilaos.com/emacs/modus-themes>).
;;; Code:
(unless (and (fboundp 'require-theme)
load-file-name
(equal (file-name-directory load-file-name)
(expand-file-name "themes/" data-directory))
(require-theme 'modus-themes t))
(require 'modus-themes))
(defcustom modus-vivendi-tinted-palette-user nil
"Like the `modus-vivendi-tinted-palette' for user-defined entries.
This is meant to extend the palette with custom named colors and/or
semantic palette mappings. Those may then be used in combination with
palette overrides (also see `modus-themes-common-palette-overrides' and
`modus-vivendi-tinted-palette-overrides')."
:group 'modus-themes
:package-version '(modus-themes . "4.5.0")
:type '(repeat (list symbol (choice symbol string)))
:link '(info-link "(modus-themes) Option to extend the palette for use with overrides"))
(defcustom modus-vivendi-tinted-palette-overrides nil
"Overrides for `modus-vivendi-tinted-palette'.
Mirror the elements of the aforementioned palette, overriding
their value.
For overrides that are shared across all of the Modus themes,
refer to `modus-themes-common-palette-overrides'.
Theme-specific overrides take precedence over shared overrides.
The idea of common overrides is to change semantic color
mappings, such as to make the cursor red. Wherea theme-specific
overrides can also be used to change the value of a named color,
such as what hexadecimal RGB value the red-warmer symbol
represents."
:group 'modus-themes
:package-version '(modus-themes . "4.0.0")
:version "30.1"
:type '(repeat (list symbol (choice symbol string)))
:link '(info-link "(modus-themes) Palette overrides"))
(modus-themes-theme
'modus-vivendi-tinted
'modus-themes
"Elegant, highly legible theme with a night sky background.
Conforms with the highest legibility standard for color contrast
between background and foreground in any given piece of text,
which corresponds to a minimum contrast in relative luminance of
7:1 (WCAG AAA standard)."
'dark
'modus-themes-vivendi-tinted-palette
'modus-vivendi-tinted-palette-user
'modus-vivendi-tinted-palette-overrides)
(provide 'modus-vivendi-tinted-theme)
;;; modus-vivendi-tinted-theme.el ends here

View file

@ -0,0 +1,95 @@
;;; modus-vivendi-tritanopia-theme.el --- Tritanopia-optimized theme with a black background -*- lexical-binding:t -*-
;; Copyright (C) 2019-2026 Free Software Foundation, Inc.
;; Author: Protesilaos <info@protesilaos.com>
;; Maintainer: Protesilaos <info@protesilaos.com>
;; URL: https://github.com/protesilaos/modus-themes
;; Keywords: faces, theme, accessibility
;; This file is part of GNU Emacs.
;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;;
;; The Modus themes conform with the highest standard for
;; color-contrast accessibility between background and foreground
;; values (WCAG AAA). They are also highly customizable and can even
;; be used as the basis for other themes. Please refer to the official
;; Info manual for further documentation (distributed with the themes,
;; or available at: <https://protesilaos.com/emacs/modus-themes>).
;;; Code:
(unless (and (fboundp 'require-theme)
load-file-name
(equal (file-name-directory load-file-name)
(expand-file-name "themes/" data-directory))
(require-theme 'modus-themes t))
(require 'modus-themes))
(defcustom modus-vivendi-tritanopia-palette-user nil
"Like the `modus-vivendi-tritanopia-palette' for user-defined entries.
This is meant to extend the palette with custom named colors and/or
semantic palette mappings. Those may then be used in combination with
palette overrides (also see `modus-themes-common-palette-overrides' and
`modus-vivendi-tritanopia-palette-overrides')."
:group 'modus-themes
:package-version '(modus-themes . "4.5.0")
:type '(repeat (list symbol (choice symbol string)))
:link '(info-link "(modus-themes) Option to extend the palette for use with overrides"))
(defcustom modus-vivendi-tritanopia-palette-overrides nil
"Overrides for `modus-vivendi-tritanopia-palette'.
Mirror the elements of the aforementioned palette, overriding
their value.
For overrides that are shared across all of the Modus themes,
refer to `modus-themes-common-palette-overrides'.
Theme-specific overrides take precedence over shared overrides.
The idea of common overrides is to change semantic color
mappings, such as to make the cursor red. Wherea theme-specific
overrides can also be used to change the value of a named color,
such as what hexadecimal RGB value the red-warmer symbol
represents."
:group 'modus-themes
:package-version '(modus-themes . "4.0.0")
:version "30.1"
:type '(repeat (list symbol (choice symbol string)))
:link '(info-link "(modus-themes) Palette overrides"))
(modus-themes-theme
'modus-vivendi-tritanopia
'modus-themes
"Tritanopia-optimized theme with a black background.
This variant is optimized for users with blue-yellow color
deficiency (tritanopia). It conforms with the highest
legibility standard for color contrast between background and
foreground in any given piece of text, which corresponds to a
minimum contrast in relative luminance of 7:1 (WCAG AAA
standard)."
'dark
'modus-themes-vivendi-tritanopia-palette
'modus-vivendi-tritanopia-palette-user
'modus-vivendi-tritanopia-palette-overrides
'modus-themes-faces-tritanopia)
(provide 'modus-vivendi-tritanopia-theme)
;;; modus-vivendi-tritanopia-theme.el ends here

372
tests/modus-themes-test.el Normal file
View file

@ -0,0 +1,372 @@
;;; modus-themes-test.el --- Unit tests for the Modus themes -*- lexical-binding: t -*-
;; Copyright (C) 2025-2026 Free Software Foundation, Inc.
;; Author: Protesilaos <info@protesilaos.com>,
;; Rudolf Adamkovič <rudolf@adamkovic.org>
;; Maintainer: Protesilaos <info@protesilaos.com>
;; URL: https://github.com/protesilaos/modus-themes
;; This file is NOT part of GNU Emacs.
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;; Tests for the Modus themes. Note that we are using Shorthands in
;; this file, so the "mtt-" prefix really is "modus-themes-test-".
;; Evaluate the following to learn more:
;;
;; (info "(elisp) Shorthands")
;;; Code:
(require 'ert)
(require 'modus-themes)
(defmacro mtt-define-test (symbol &rest body)
"Write test for SYMBOL with BODY forms.
If the `car' of BODY is a string, use it as the docstring of the test.
Else provide a generic snippet of text."
(declare (doc-string 2) (indent defun))
(let* ((first (car body))
(has-docstring (stringp first))
(docstring (if has-docstring
first
(format "Test that `%s' does the right thing." symbol)))
(body (if has-docstring (cdr body) body)))
`(ert-deftest ,(intern (format "mtt-%s" symbol)) ()
,docstring
,@body)))
(mtt-define-test modus-themes--color-hex-p
(should (modus-themes--color-hex-p "#123"))
(should (modus-themes--color-hex-p "#123456"))
(should (modus-themes--color-hex-p "#abc"))
(should (modus-themes--color-hex-p "#ABCDEF"))
(should-not (modus-themes--color-hex-p "abc"))
(should-not (modus-themes--color-hex-p "#abcd"))
(should-not (modus-themes--color-hex-p "#12345"))
(should-not (modus-themes--color-hex-p "#1234567"))
(should-not (modus-themes--color-hex-p "#zzz"))
(should-not (modus-themes--color-hex-p "#zzz"))
(should-not (modus-themes--color-hex-p "#12g456")))
(mtt-define-test modus-themes--hex-or-name-to-rgb
(should (equal (modus-themes--hex-or-name-to-rgb "#fff") (list 1.0 1.0 1.0)))
(should (equal (modus-themes--hex-or-name-to-rgb "#000") (list 0.0 0.0 0.0)))
(should (equal (modus-themes--hex-or-name-to-rgb "#f00") (list 1.0 0.0 0.0)))
(should (equal (modus-themes--hex-or-name-to-rgb "#0f0") (list 0.0 1.0 0.0)))
(should (equal (modus-themes--hex-or-name-to-rgb "#00f") (list 0.0 0.0 1.0)))
(should (equal (modus-themes--hex-or-name-to-rgb "#ffffff") (list 1.0 1.0 1.0)))
(should (equal (modus-themes--hex-or-name-to-rgb "#000000") (list 0.0 0.0 0.0)))
(should (equal (modus-themes--hex-or-name-to-rgb "#ff0000") (list 1.0 0.0 0.0)))
(should (equal (modus-themes--hex-or-name-to-rgb "#00ff00") (list 0.0 1.0 0.0)))
;; NOTE 2026-04-12: I do not need it to be precise here, hence the `format'.
(let ((rgb-rounded-fn
(lambda (hex)
(let ((rgb (modus-themes--hex-or-name-to-rgb hex)))
(mapcar (lambda (float) (string-to-number (format "%.2f" float))) rgb)))))
(should (equal (funcall rgb-rounded-fn "#800000") (list 0.5 0.0 0.0)))
(should (equal (funcall rgb-rounded-fn "#008000") (list 0.0 0.5 0.0)))
(should (equal (funcall rgb-rounded-fn "#000080") (list 0.0 0.0 0.5))))
(should-error (modus-themes--hex-or-name-to-rgb ""))
(should-error (modus-themes--hex-or-name-to-rgb "#"))
(should-error (modus-themes--hex-or-name-to-rgb "#1"))
(should-error (modus-themes--hex-or-name-to-rgb "#12"))
(should-error (modus-themes--hex-or-name-to-rgb "#1234"))
(should-error (modus-themes--hex-or-name-to-rgb "#12345"))
(should-error (modus-themes--hex-or-name-to-rgb "#gggggg"))
(should-error (modus-themes--hex-or-name-to-rgb (list 1.0 1.0 1.0))))
(mtt-define-test modus-themes-wcag-formula
"Test that `modus-themes-wcag-formula' does the right thing.
Also see `modus-themes-test--modus-themes--hex-to-rgb'."
(should (= (modus-themes-wcag-formula "#ffffff") 1.0))
(should (= (modus-themes-wcag-formula "#000000") 0.0))
(should-error (modus-themes-wcag-formula "#00000")))
(mtt-define-test modus-themes-contrast
"Test that `modus-themes-contrast' works as intended.
Also see `modus-themes-test--modus-themes--hex-to-rgb'."
(should (= (modus-themes-contrast "#ffffff" "#000000") 21.0))
(should (= (modus-themes-contrast "#000000" "#ffffff") 21.0))
;; NOTE 2026-04-12: I do not need it to be precise here, hence the `format'.
(let ((float-2-fn (lambda (hex1 hex2) (string-to-number (format "%.2f" (modus-themes-contrast hex1 hex2))))))
(should (= (funcall float-2-fn "#ff0000" "#ffffff") 4.0))
(should (= (funcall float-2-fn "#00ff00" "#ffffff") 1.37))
(should (= (funcall float-2-fn "#0000ff" "#ffffff") 8.59))
(should (= (funcall float-2-fn "#ffff00" "#ffffff") 1.07))
(should (= (funcall float-2-fn "#00ffff" "#ffffff") 1.25))
(should (= (funcall float-2-fn "#ff00ff" "#ffffff") 3.14)))
(should-error (modus-themes-contrast "#ffffff" "#00000"))
(should-error (modus-themes-contrast "#fffff" "#00000")))
(mtt-define-test modus-themes--color-eight-to-six-digits
(should (string= (modus-themes--color-eight-to-six-digits "#f00") "#f00"))
(should (string= (modus-themes--color-eight-to-six-digits "#ff1919") "#ff1919"))
(should (string= (modus-themes--color-eight-to-six-digits "#ffff19991999") "#ff1919")))
(mtt-define-test modus-themes-adjust-value
"Test that `modus-themes-adjust-value' does the right thing.
Also see `modus-themes-test--modus-themes--hex-to-rgb'."
(should (string= (modus-themes-adjust-value "#ff0000" 10) "#ff1919"))
(should (string= (modus-themes-adjust-value "#505050" 100) "#ffffff"))
(should (string= (modus-themes-adjust-value "#505050" -100) "#000000"))
(should (string= (modus-themes-adjust-value "#505050" 0) "#505050"))
(should-error (modus-themes-adjust-value "#ff00" 10)))
(mtt-define-test modus-themes-activate
(if (custom-theme-p 'modus-operandi-tritanopia)
(should-not (modus-themes-activate 'modus-operandi-tritanopia))
(should (custom-theme-p 'modus-operandi-tritanopia))))
(mtt-define-test modus-themes--belongs-to-family-p
(should (modus-themes--belongs-to-family-p 'modus-operandi 'modus-themes))
(should-not (modus-themes--belongs-to-family-p 'my-fancy-theme 'modus-themes))
(should-not (modus-themes--belongs-to-family-p 'modus-operandi 'my-fancy-themes)))
(mtt-define-test modus-themes-get-all-known-themes
(should (equal (modus-themes-get-all-known-themes) modus-themes-items))
(should-not (modus-themes-get-all-known-themes 'my-fancy-themes)))
(mtt-define-test modus-themes--background-p
(should (modus-themes--background-p 'modus-operandi 'light))
(should-not (modus-themes--background-p 'modus-operandi 'dark))
(should-not (modus-themes--background-p 'modus-operandi t))
(should-not (modus-themes--background-p 'modus-operandi :light)))
(mtt-define-test modus-themes-sort
(let ((first-has-prefix-fn (lambda (themes prefix)
(when-let* ((first (car themes))
(name (symbol-name first)))
(string-match-p prefix name)))))
(should (funcall first-has-prefix-fn (modus-themes-sort (reverse modus-themes-items) 'light) "modus-operandi"))
(should (funcall first-has-prefix-fn (modus-themes-sort modus-themes-items 'dark) "modus-vivendi"))))
(mtt-define-test inheritance
"Ensure all faces inherit from valid faces."
;; Third-party packages, loaded if possible to better test face inheritance.
(require 'font-latex nil t)
(let ((current-theme (modus-themes-get-current-theme)))
(unwind-protect
(progn
(modus-themes-load-theme 'modus-operandi)
(should-not (seq-filter
(lambda (face)
;; The face either has no parent ...
(if-let* ((parent (face-attribute face :inherit)))
(and (symbolp parent)
(not (eq parent 'unspecified))
;; ... or its parent is a valid face.
(not (facep parent)))))
(face-list))))
(modus-themes-load-theme current-theme))))
(mtt-define-test color-dark-p
(let ((modus-operandi-sample-foregrounds
'("#a60000"
"#972500"
"#a0132f"
"#7f0000"
"#006800"
"#316500"
"#00663f"
"#2a5045"
"#6f5500"
"#884900"
"#7a4f2f"
"#624416"
"#0031a9"
"#3548cf"
"#0000b0"
"#003497"
"#721045"
"#8f0075"
"#531ab6"
"#7c318f"
"#005e8b"
"#3f578f"
"#005f5f"
"#005077"))
(modus-vivendi-sample-foregrounds
'("#ff5f59"
"#ff6b55"
"#ff7f86"
"#ff9580"
"#44bc44"
"#70b900"
"#00c06f"
"#88ca9f"
"#d0bc00"
"#fec43f"
"#dfaf7a"
"#d2b580"
"#2fafff"
"#79a8ff"
"#00bcff"
"#82b0ec"
"#feacd0"
"#f78fe7"
"#b6a0ff"
"#caa6df"
"#00d3d0"
"#4ae2f0"
"#6ae4b9"
"#9ac8e0")))
(should (seq-every-p #'modus-themes-color-dark-p modus-operandi-sample-foregrounds))
(should-not (seq-every-p #'modus-themes-color-dark-p modus-vivendi-sample-foregrounds))))
(mtt-define-test get-readable-foreground
(let ((modus-operandi-sample-foregrounds
'("#a60000"
"#972500"
"#a0132f"
"#7f0000"
"#006800"
"#316500"
"#00663f"
"#2a5045"
"#6f5500"
"#884900"
"#7a4f2f"
"#624416"
"#0031a9"
"#3548cf"
"#0000b0"
"#003497"
"#721045"
"#8f0075"
"#531ab6"
"#7c318f"
"#005e8b"
"#3f578f"
"#005f5f"
"#005077"))
(modus-vivendi-sample-foregrounds
'("#ff5f59"
"#ff6b55"
"#ff7f86"
"#ff9580"
"#44bc44"
"#70b900"
"#00c06f"
"#88ca9f"
"#d0bc00"
"#fec43f"
"#dfaf7a"
"#d2b580"
"#2fafff"
"#79a8ff"
"#00bcff"
"#82b0ec"
"#feacd0"
"#f78fe7"
"#b6a0ff"
"#caa6df"
"#00d3d0"
"#4ae2f0"
"#6ae4b9"
"#9ac8e0")))
(should (seq-every-p
(lambda (value)
(string= value "#ffffff"))
(mapcar #'modus-themes-get-readable-foreground modus-operandi-sample-foregrounds)))
(should (seq-every-p
(lambda (value)
(string= value "#000000"))
(mapcar #'modus-themes-get-readable-foreground modus-vivendi-sample-foregrounds)))))
(mtt-define-test complete-palette-mappings
"Ensure all built-in palettes contain entries for all palette mappings.
This computes a complete list of mapping names from the built-in palettes
and then cross-checks the palettes against the list. This should help ensure
consistency and completeness where adding a new mapping in one palette will
fail this test until it is added in all palettes."
(let* ((operandi-names (seq-uniq (mapcar #'car modus-themes-operandi-palette)))
(operandi-tinted-names (seq-uniq (mapcar #'car modus-themes-operandi-tinted-palette)))
(operandi-deuteranopia-names (seq-uniq (mapcar #'car modus-themes-operandi-deuteranopia-palette)))
(operandi-tritanopia-names (seq-uniq (mapcar #'car modus-themes-operandi-tritanopia-palette)))
(vivendi-names (seq-uniq (mapcar #'car modus-themes-vivendi-palette)))
(vivendi-tinted-names (seq-uniq (mapcar #'car modus-themes-vivendi-tinted-palette)))
(vivendi-deuteranopia-names (seq-uniq (mapcar #'car modus-themes-vivendi-deuteranopia-palette)))
(vivendi-tritanopia-names (seq-uniq (mapcar #'car modus-themes-vivendi-tritanopia-palette)))
(all-names (seq-uniq (append operandi-names
operandi-tinted-names
operandi-deuteranopia-names
operandi-tritanopia-names
vivendi-names
vivendi-tinted-names
vivendi-deuteranopia-names
vivendi-tritanopia-names))))
(should (seq-empty-p (seq-difference all-names operandi-names)))
(should (seq-empty-p (seq-difference all-names operandi-tinted-names)))
(should (seq-empty-p (seq-difference all-names operandi-deuteranopia-names)))
(should (seq-empty-p (seq-difference all-names operandi-tritanopia-names)))
(should (seq-empty-p (seq-difference all-names vivendi-names)))
(should (seq-empty-p (seq-difference all-names vivendi-tinted-names)))
(should (seq-empty-p (seq-difference all-names vivendi-deuteranopia-names)))
(should (seq-empty-p (seq-difference all-names vivendi-tritanopia-names)))))
(mtt-define-test modus-themes-generate-palette
"Ensure `modus-themes-generate-palette' provides enough mapping coverage
such that the generated palette does not inherit explicit color values
from a parent core palette."
(let* ((generated-palette (modus-themes-generate-palette
'((fg-main "#ffffff")
(bg-main "#000000")
(red "#ff0000")
(green "#00ff00")
(yellow "#ffff00")
(blue "#0000ff")
(magenta "#ff00ff")
(cyan "#00ffff"))))
;; These are colors we expect to have an explicit hex value,
;; either because they were provided explicitly in the call to
;; `modus-themes-generate-palette' above, or because we expect
;; `modus-themes-generate-palette' to generate the color.
(explicit-colors '( fg-main bg-main
fg-alt fg-dim bg-inactive bg-active bg-dim border
;; cyan
cyan bg-cyan-nuanced bg-cyan-subtle bg-cyan-intense
cyan-intense cyan-faint cyan-cooler cyan-warmer
;; magenta
magenta bg-magenta-nuanced bg-magenta-subtle bg-magenta-intense
magenta-intense magenta-faint magenta-cooler magenta-warmer
;; blue
blue bg-blue-nuanced bg-blue-subtle bg-blue-intense
blue-intense blue-faint blue-cooler blue-warmer
;; yellow
yellow bg-yellow-nuanced bg-yellow-subtle bg-yellow-intense
yellow-intense yellow-faint yellow-cooler yellow-warmer
;; green
green bg-green-nuanced bg-green-subtle bg-green-intense
green-intense green-faint green-cooler green-warmer
;; red
red bg-red-nuanced bg-red-subtle bg-red-intense
red-intense red-faint red-cooler red-warmer)))
;; Ensure all other colors in the palette map to a color name and not an
;; explicit hex value. If this check fails, the offending color should
;; be mapped to an appropriate color name in `modus-themes-generate-palette'.
(should (seq-empty-p (seq-remove (lambda (elem)
(or (member (car elem) explicit-colors)
(symbolp (cadr elem))))
generated-palette)))))
(provide 'modus-themes-test)
;;; modus-themes-test.el ends here
;; Local Variables:
;; read-symbol-shorthands: (("mtt" . "modus-themes-test-"))
;; End: