Ef themes 0.4.0 for GNU Emacs

The ef-themes are a collection of light and dark themes for GNU Emacs whose goal is to provide colourful (“pretty”) yet legible options for users who want something with a bit more flair than the modus-themes (also designed by me). Watch the presentation of the original version, which demonstrates the first eight themes in the collection and explains a few technical points: https://protesilaos.com/codelog/2022-08-18-ef-themes-demo/.


New deuteranopia-friendly themes

Designed two bespoke themes for users with red-green colour deficiency or blindness (deuteranopia). They rely on blue and yellow hues. Their names are:

  • ef-deuteranopia-dark
  • ef-deuteranopia-light

Announcement with sample pictures: https://protesilaos.com/codelog/2022-08-19-ef-themes-deuteranopia/.

User options

  • Introduced the variable ef-themes-mixed-fonts. When it is set to a non-nil (t) value, it makes spacing-sensitive elements use a monospaced font. For example, Org tables and code blocks will always look properly aligned. This is useful for those who either use a proportionately spaced font as their default or enable the built-in variable-pitch-mode.

  • Implemented the variable ef-themes-variable-pitch-ui. When it is set to a non-nil (t) value, it renders the mode-line, tab-bar-mode, and tab-line-mode in a proportionately spaced font.

User options must be set before the theme is loaded. If an option changes, its value will be read upon a theme re-load.

For font configurations, refer to my fontaine package.

Newly supported packages

Built into Emacs:

  • eww
  • shell-script-mode (sh-mode)
  • shr

External packages:

  • consult
  • embark

Refinements to faces

  • Fixed the scaling of current line of display-line-numbers-mode when text-scale-adjust was invoked. Basically I forgot to include the line-number face, while all others were covered. Thanks to Anthony Chavez for the feedback in issue 7 over at the GitHub mirror: https://github.com/protesilaos/denote/issues/7.

  • Covered all faces that define group titles in completion contexts. These are headings which are used by various commands, such as consult-buffer, consult-imenu, and consult-grep. As they denote a group name, we apply the name colour mapping (the hue differs for each theme). And since they are titles, we inherit from bold to make them look like headings. Thanks to Summer Emacs for the feedback which amounted to:
    1. Treating group titles as headings.
    2. Using a more consistent colour theme-wide.
  • Revised the compilation-info face from a colour-coded “success” face to a value that is consistent with the semantics of its application in file names or related (as seen in the emacs.git repository). For example, file names in Grep or Xref buffers will now look like they belong to the theme, whereas before they were predominantly green, even when that did not make sense. This point is connected to the above, such as in workflows that go from the minibuffer to a Grep buffer (e.g. with the use of the embark package).

  • Toned down the vertical border between windows by explicitly supporting the vertical-border face. The previous design would use the main foreground which generally led to a disproportionately intense result.

  • Adjusted all spacing-sensitive faces to accommodate the user option ef-themes-mixed-fonts, as noted above. Also thanks to Christopher League for spotting that I had missed the line-number face and for providing the relevant patch (I do the same in the modus-themes): https://lists.sr.ht/~protesilaos/ef-themes/%3C871qt2x4wi.fsf%40nita.mail-host-address-is-not-set%3E

    The patch is well below the ~15 line threshold and thus does not require copyright assignment to the Free Software Foundation.

  • Enforced mono spacing for the org-indent face. This is essential for org-indent-mode to align entries correctly. Thanks to Steve Molitor for reporting this in the issue 9 over at the GitHub mirror: https://github.com/protesilaos/ef-themes/issues/9. Steve tested a sample file with modus-vivendi and got the desired results. It reminded me how I handle this face in the modus-themes.

  • Added explicit support for the bold and italic faces. The default definition of italic has conditionality which we do not want, such as drawing an underline if the font does not have italics (e.g. Fira Code). Styling it at the theme level prevents that from happening: the font without italics will simply use the upright/roman glyphs. Adding bold is just for clarity. Its default definition is fine.

  • Made the tabs of the built-in tab-bar-mode and tab-line-mode stand out more. The difference between the current tab and the rest was too subtle. Depending on the lighting conditions, their respective backgrounds were indistinguishable. Thanks to Summer Emacs for reporting this issue and for helping me decide on the final design.

  • Applied tinted backgrounds to values and arguments in transient.el buffers (e.g. Magit). They now stand out better.

Documentation

  • Created a page with screenshots of all the Ef themes: https://protesilaos.com/emacs/ef-themes-pictures.

  • Answered the Frequently Asked Question of letting Org tags inherit the foreground colour of the heading they belong to. The gist (though note that the entry also mentions the option for the non-alignment of tags):

    Upstream Org defines tags in headings to have the same color as the rest of the heading’s text. However, tags are a distinct component of the heading as noted in the doc string of the org-get-heading function. Tags also are functionally different than the ordinary text of the heading: they are a clickable link/button. It thus is a matter of usability to render this distinction clear at the visual level: I do not agree with upstream Org’s design decision.

  • Addressed another Frequently Asked Question on whether we can have Ef-style themes inspired by the Nord or Zenburn themes. The short version is that this is technically difficult and undesirable. Each palette in the Ef themes collection is original and is designed around the normative and aesthetic principles of this project.

  • Wrote an entire section on Do-It-Yourself customisations. These generally are for advanced users, though the manual provides concrete examples of using the ef-themes-with-colors macro in tandem with the ef-themes-post-load-hook.

  • Elaborated on the list of packages that I will most likely NOT support in the Ef themes. The reasons vary though. Quote:

    These are difficult to support due to their (i) incompatibility with the design of the ef-themes, (ii) complexity or multiple points of entry, (iii) external dependencies, (iv) existence of better alternatives in my opinion, or (v) inconsiderate use of color out-of-the-box and implicit unwillingness to be good Emacs citizens

    If a certain package does not look right, then it is not supported (yet).

The manual can be read from Emacs, if the ef-themes package is installed. Evaluate:

(info "(ef-themes) Top")

Else visit: https://protesilaos.com/emacs/ef-themes.

Internal refinements

  • Recalibrated diff colours or the context of diff buffers, especially in Magit, to improve usability.

  • Adjusted or otherwise tweaked the hues that apply to key bindings and links in order to reinforce the stylistic consistency of each theme.

  • Introduced a yellow-tinted background which is used in various contexts that (i) should be styled with a coloured background but (ii) should not be colour-coded as either red or green/blue.

  • Made the ef-themes-with-colors macro always reify the current Ef theme’s palette. This macro is for advanced users. Its utility is documented in the themes’ manual.

  • Fixed how themes become “known” at startup. Before, they were not registered correctly for immediate use with the ef-themes-select command. Thanks to Jean-Philippe GagnĂ© Guay for the feedback in issue 6 over at the GitHub mirror: https://github.com/protesilaos/denote/issues/6.

  • Tweaked some face attributes to work with Emacs 27.

  • Tinkered with the colour mapping or precise values of practically all the themes. Better consult the Git log for the minutiae. I think the identity of each theme is largely defined, though there may still be tweaks to be done here and there until we eventually reach version 1.0.0.