protesilaos / modus-themes

Highly accessible themes for GNU Emacs, conforming with the highest standard for colour contrast between background and foreground values (WCAG AAA).
https://protesilaos.com/emacs/modus-themes
GNU General Public License v3.0
553 stars 30 forks source link

Hacking at modus-themes.el to allow for face-specific family selection #97

Closed c-wicklein closed 8 months ago

c-wicklein commented 8 months ago

Greetings,

After switching to Modus themes (which are the closet thing I've found to objectively correct Emacs themes), I got greedy and decided to mix font families (Monaspace fonts have common metrics, so mixing a fixed-width "printed" font with the fixed-width "hand-written" font for comments looks nice.)

Unfortunately, I couldn't figure out how to do this well, so I did it badly (delta below.). Is this an expected customization which Modus themes explicitly support?

Thanks!

--- a/modus-themes.el
+++ b/modus-themes.el
@@ -2521,7 +2521,7 @@ FG and BG are the main colors."
 ;;;;; font-lock
     `(font-lock-builtin-face ((,c :inherit modus-themes-bold :foreground ,builtin)))
     `(font-lock-comment-delimiter-face ((,c :inherit font-lock-comment-face)))
-    `(font-lock-comment-face ((,c :inherit modus-themes-slant :foreground ,comment)))
+    `(font-lock-comment-face ((,c :inherit modus-themes-slant :foreground ,comment :family "Monaspace Radon")))
     `(font-lock-constant-face ((,c :foreground ,constant)))
     `(font-lock-doc-face ((,c :inherit modus-themes-slant :foreground ,docstring)))
     `(font-lock-doc-markup-face ((,c :inherit modus-themes-slant :foreground ,docmarkup)))
protesilaos commented 8 months ago

From: Chris Wicklein @.***> Date: Wed, 17 Jan 2024 05:16:13 -0800

Greetings,

Hello there!

After switching to Modus themes (which are the closet thing I've found to objectively correct Emacs themes), I got greedy and decided to mix font families (Monaspace fonts have common metrics, so mixing a fixed-width "printed" font with the fixed-width "hand-written" font for comments looks nice.)

Unfortunately, I couldn't figure out how to do this well, so I did it badly (delta below.). Is this an expected customization which Modus themes explicitly support?

Thanks!

--- a/modus-themes.el
+++ b/modus-themes.el
@@ -2521,7 +2521,7 @@ FG and BG are the main colors."
 ;;;;; font-lock
     `(font-lock-builtin-face ((,c :inherit modus-themes-bold :foreground ,builtin)))
     `(font-lock-comment-delimiter-face ((,c :inherit font-lock-comment-face)))
-    `(font-lock-comment-face ((,c :inherit modus-themes-slant :foreground ,comment)))
+    `(font-lock-comment-face ((,c :inherit modus-themes-slant :foreground ,comment :family "Monaspace Radon")))
     `(font-lock-constant-face ((,c :foreground ,constant)))
     `(font-lock-doc-face ((,c :inherit modus-themes-slant :foreground ,docstring)))
     `(font-lock-doc-markup-face ((,c :inherit modus-themes-slant :foreground ,docmarkup)))

Try this:

(set-face-attribute 'font-lock-comment-face nil :family "Monaspace Radon")

Two relevant videos I did recently which use 'set-face-attribute':

  1. https://protesilaos.com/codelog/2024-01-13-customize-emacs-mode-line/
  2. https://protesilaos.com/codelog/2024-01-16-customize-emacs-fonts/

-- Protesilaos Stavrou https://protesilaos.com

c-wicklein commented 8 months ago

Thanks! Evaluating that after theme loading did the trick.