Protesilaos Stavrou: Emacs: modus-themes version 5.0.0

Wait 5 sec.

I just published the latest stable release of the Modusthemes. The change logentry is reproduced further below. For any questions, you are welcometo contact me. I will now work toapply these same changes to emacs.git, so please wait a little longerfor the updates to trickle down to you. Package name (GNU ELPA): modus-themes (also built into Emacs 28+) 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.5.0.0 on 2025-11-01This is a major release. There are some small breaking changes. Thebig new feature is that Modus can be used as the basis for other themeprojects. Two of my other theme packages, the ef-themes and thestandard-themes are already done in this way: their next majorversions will formalise what I have been developing for a while now(though the doric-themes will remain their own thing for the timebeing).Build on top of ModusThis is of immediate interest to package developers or advanced users.It changes nothing for existing users of the Modus themes. Pleaserefer to the manual on the matter and feel welcome to contact me ifyou have any questions—I am happy to help.Evaluate:(info "(modus-themes) Build on top of the Modus themes")Or visit: https://protesilaos.com/emacs/modus-themes#h:86eb375b-9be4-43ce-879a-0686a524a63b.Why build on top of Modus? To benefit from (i) the wide face coverageand extensive detail-oriented testing, (ii) the use of palettemappings, (iii) the palette preview done withmodus-themes-list-colors or related, (iv) the inclusion of thederivative theme in the workings of all Modus commands that load atheme, like modus-themes-rotate and modus-themes-select (see thenew minor mode modus-themes-include-derivatives-mode).Derivative themes can be as simple as a few extra colours on top of,say, modus-operandi. They can also be more involved, with newpalette mappings and custom faces that use them. Such themes candefine commands which load only their own themes (seemodus-themes-define-derivative-command) and they can even take overthe Modus themes completely, in terms of becoming the only ones thatare exposed to the commands that load a theme, likemodus-themes-rotate and modus-themes-select.Thanks to Suleyman Boyar for fixing an intermediate omission with anearlier version of the code that derives a theme. I did eventuallychange the whole approach to use a function instead of a macro, butSuleyman’s contribution was still useful at the time. This was done inpull request 156: https://github.com/protesilaos/modus-themes/pull/156.The change is small, meaning that Suleyman does not need to assigncopyright to the Free Software Foundation.Colours can be copied from the palette preview bufferThe commands modus-themes-list-colors and modus-themes-list-colors-currentdisplay the given theme’s palette in a tabulated listing. Each linevisualises the colour it references. From that buffer it is nowpossible to call the following commands (bound to the modus-themes-preview-mode-map): Default key binding Name of the command w modus-themes-preview-mode-copy-color W modus-themes-preview-mode-copy-entry m modus-themes-preview-mode-mark M modus-themes-preview-mode-mark-all u modus-themes-preview-mode-unmark U modus-themes-preview-mode-unmark-all The modus-themes-preview-mode-copy-color and itsmodus-themes-preview-mode-copy-entry counterpart work on the line atpoint or those that are marked. The first copies the resolved colourvalue, as a string (“resolved” here means that it will find what apalette mapping actually stands for). The second gets the completepalette entry, as it appears in the underlying definition. This is astarting point for writing palette overrides.Thanks to shimeike for reporting a problem with a regression Iintroduced by mistake in one of the development versions of thefunction that handles the creation of the tabulated list. This wasdone in issue 163: https://github.com/protesilaos/modus-themes/issues/163.New semantic palette mappings for programming contextsThe fnname-call and variable-use are now available. They areapplied to faces that are used by major modes which build on top oftree-sitter program as well as the Emacs Lisp semantic highlightingfeature of Emacs 31.By default, these colours are more subtle than their fnname andvariable counterparts. The reason is that I want to avoidexaggerations with the wanton application of colour (“avoidingexaggerations” is one of the design principles of the Modus themes).Because of the commitment to the highest legibility standard forcolour contrast, we are using colours that stand out in their context,yet are still harmonious with each other. This is due to (i) carefulconsideration of colour harmonies, (ii) enforced uniformity of styleswhere necessary to avoid emphasising the emphasis or stating theobvious, and (ii) the fact that not too many intense colours appear inclose proximity to each other in most Emacs major modes. If a majormode or other feature adds colours virtually everywhere, then theModus themes are no longer true to their character and becomeborderline unusable.The more subtle colours for fnname-call and variable-use do notprevent exaggerations, though they do make them less egregious.[ Note that themes do not control which face is applied where. That is the job of a major mode or specialised minor modes. When in doubt, work with the rule that fewer colours are better than many. ]Support for Emacs Lisp semantic highlightingThis is built into Emacs version 31. What it does is make differentparts of the Elisp syntax stand out visually. It also augments themwith a mouse tooltip (technically a help-echo) that providesvaluable insights about what the thing is.Thanks to Eshel Yaron, the author of this feature, for (i) asking meto review the relevant faces, (ii) helping me understand what“semantic highlighting” is intended for, and (iii) explaining to mehow some faces are meant to be used. This was done in the context ofEmacs bug 79677 and in an aside about a change to my minimalistdoric-themes package: https://lists.gnu.org/archive/html/bug-gnu-emacs/2025-10/msg01156.html. https://lists.gnu.org/archive/html/emacs-devel/2025-10/msg00728.html.I wrote to Eshel that I do not want many colours clustered together.This design is more suitable to themes with low intensity. All mythemes exacerbate the effect of dense colouration due to their primarydesign goal: legibility.Currently the added colouration of semantic highlighting is noticeablefar more than I like. This is a compromise on my end. Future versionsof the themes might set more semantic faces to nil (or anyhow makethem subtle), subject to further review and user feedback.This is not a position against semantic highlighting, but a comment oninconsiderate themes.More elements are optionally bold or italicI have revised all supported faces to make them more conservativeabout when they apply typographic qualities that deviate from thedefault font. Many faces that were unconditionally rendered with abold weight or an italic slant are now subject to the user optionsmodus-themes-bold-constructs and modus-themes-italic-constructs.This means that they are like the default font family by default andwill become bold/italic if the relevant user option is set to anon-nil value.Faces that are semantically bold or italic and/or which genuinelybenefit from such typographic attributes out-of-the-box are exemptfrom this.Headings are also exempt because they are anyway subject to the useroption modus-themes-headings which covers the height and weight ofeach heading level’s text.Thanks to chainedghost for reporting a regression in one of thecommits I made. This was done in issue 167:https://github.com/protesilaos/modus-themes/issues/167Support for lsp-mode and lsp-ui packagesThanks to Jimmy Yuen Ho Wong for the initial contribution in pullrequest 142: https://github.com/protesilaos/modus-themes/pull/142.I made some changes on top to use semantic palette mappings, whereapplicable, and other such tweaks.The minibuffer-nonselected face is supportedThis is coming in Emacs version 31: it highlights the activeminibuffer when the cursor is in another window. The face is designedto be as noticeable as possible because this kind of scenario usuallyleads to mistakes or confusion.Refinements to supported packages or face groups The markdown-code-face uses the same semantic palette mapping asorg-block. This was always the intent. Thanks to Frédéric Giquelfor the fix in pull request 160: https://github.com/protesilaos/modus-themes/pull/160.The change is small and thus does not require copyright assignmentto the Free Software Foundation. Fixed a word in the symbol of the flymake-warning-echo-at-eol. Thanks toEric Ottosson for the patch in pull request 145: https://github.com/protesilaos/modus-themes/pull/145.No copyright assignment is required. The two new Emacs 31 faces for packages that are marked forinstallation or deletion in the M-x list-packages buffer are nowincluded. Thanks to Gautier Ponsinet for sending me the patch.Gautier has assigned copyright to the Free Software Foundation. The hs-ellipsis in Emacs 31 from the built-in hideshow packageis also covered. It is made to conform with established patternsacross conceptually equivalent faces (e.g. Org folded headings)rather than do its own thing. The widget-field uses an underline to be easier to spot. Onsupported Emacs displays (generally graphical Emacs) the underlineis at the descent line, meaning that it does not cross throughcharacters with descenders like g. The git-commit and log-edit faces for writing commit messages inMagit and VC are tweaked to avoid exaggerations. The Magit section headings have a slightly modified foregroundvalue. The org-list-dt face for list definition terms has a slightlymodified foreground value to (i) be easier to spot while (ii) beingless intense overall. The calendar-today in the M-x calendar interface now has a boxaround it on supported displays (graphical Emacs) to better standout from its context. On unsupported displays, the face still getsan appropriate background value. The org-date-selected and calendar-today should look the same,contrary to how they did before. This is done in the interest oftheme-wide consistency (i.e. the kind of detail you appreciate onceit is no longer there). The mode lines use an underline on displays that cannot render abox. This way, the faces remain distinct from their context. All interface buttons, like those that appear in the Custom buffers,will be rendered with an underline on displays that cannot handleboxes. The notmuch-message-summary-face, which is used in threadedmessage views, now has an overline on supported displays (graphicalEmacs). Individual messages in the thread should thus be morediscernible. The tab-bar-tab-highlight is directly covered to make sure allmouse hover effects are consistent across similar interfaces. Some faces that had specific colour values (e.g. cyan-cooler) arerevised to use semantic palette mappings instead. This ensuresthematic consistency. The most obvious beneficiaries are users ofthe deuteranopia- and tritanopia- optimised themes(deuteranopia-friendly themes cannot work with red and green whiletritanopia-friendly themes must not rely on yellow and blue). The modus-themes-custom-auto-reload is obsoletePlus all our user options no longer specify a :set function. Thismeans that the theme will never be reloaded automatically when usingthe Custom interface or setopt to configure one of the theme’s useroptions. Reloading the theme is what applies the new styles. The ideaof this feature is good, but the implementation was problematic. MaybeI will reinstate it in the future, though I cannot let it block thismajor release.Several modus-themes-* faces are obsoleteIn previous versions I was defining faces that were used to applyuniform styles across many packages. This was the old way of doingthings before version 4.0.0 of the themes that introduced paletteswith semantic mappings and, optionally, user-defined overrides tothem.I have deprecated all of the following and made all the necessarychanges (i.e. several thousands of them), to make palette mappings thenorm everywhere. In general, I encourage you not to rely on any facesdefined by Modus: they are really intended for internal use. modus-themes-fg-blue modus-themes-fg-blue-cooler modus-themes-fg-blue-faint modus-themes-fg-blue-intense modus-themes-fg-blue-warmer modus-themes-fg-cyan modus-themes-fg-cyan-cooler modus-themes-fg-cyan-faint modus-themes-fg-cyan-intense modus-themes-fg-cyan-warmer modus-themes-fg-green modus-themes-fg-green-cooler modus-themes-fg-green-faint modus-themes-fg-green-intense modus-themes-fg-green-warmer modus-themes-fg-magenta modus-themes-fg-magenta-cooler modus-themes-fg-magenta-faint modus-themes-fg-magenta-intense modus-themes-fg-magenta-warmer modus-themes-fg-red modus-themes-fg-red-cooler modus-themes-fg-red-faint modus-themes-fg-red-intense modus-themes-fg-red-warmer modus-themes-fg-yellow modus-themes-fg-yellow-cooler modus-themes-fg-yellow-faint modus-themes-fg-yellow-intense modus-themes-fg-yellow-warmer modus-themes-intense-blue modus-themes-intense-cyan modus-themes-intense-green modus-themes-intense-magenta modus-themes-intense-red modus-themes-intense-yellow modus-themes-key-binding modus-themes-lang-error modus-themes-lang-note modus-themes-lang-warning modus-themes-mark-alt modus-themes-mark-del modus-themes-mark-sel modus-themes-nuanced-blue modus-themes-nuanced-cyan modus-themes-nuanced-green modus-themes-nuanced-magenta modus-themes-nuanced-red modus-themes-nuanced-yellow modus-themes-prominent-error modus-themes-prominent-note modus-themes-prominent-warning modus-themes-prose-code modus-themes-prose-macro modus-themes-prose-verbatim modus-themes-search-current modus-themes-search-lazy modus-themes-search-replace modus-themes-search-rx-group-0 modus-themes-search-rx-group-1 modus-themes-search-rx-group-2 modus-themes-search-rx-group-3 modus-themes-search-static modus-themes-subtle-blue modus-themes-subtle-cyan modus-themes-subtle-green modus-themes-subtle-magenta modus-themes-subtle-red modus-themes-subtle-yellowThanks to Kevin Fleming and Jimmy Yuen Ho Wong for fixing two cases ofunbalanced/faulty parentheses caused by the aforementioned. These weredone as pull requests 166 and 168, respectively: https://github.com/protesilaos/modus-themes/pull/166. https://github.com/protesilaos/modus-themes/pull/168.Both changes are small: no copyright assignment to the Free SoftwareFoundation is needed (and I think both authors are covered, anyway).All :inherit face attributes are reviewed and kept to a minimumThe themes now use the :inherit attribute much more cautiously thanbefore. This is because of the reliance on semantic palette mappings:those give us more control and usually are explicit about the desiredresult.Face inheritance can become circular in some cases. Newer Emacsversions throw an error accordingly. This was discussed in Emacs bug79672, with participation from Eli Zaretskii, JD Smith, Manuel Giraud,Stephane Marks, and Steven Allen: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=79672.Thanks to everybody involved!