This is one of our practical examples to override the semantic colors of the Modus themes (Stylistic variants using palette overrides). In this section we show how to reproduce what previous versions of the Modus themes provided as a stylistic alternative for code syntax. The upside of using overrides for this purpose is that we can tweak the style to our liking, but first let’s start with its recreation:
;; The old "alt-syntax" (before version 4.0.0 of the Modus themes)
(setq modus-themes-common-palette-overrides
'((builtin magenta)
(comment fg-dim)
(constant magenta-cooler)
(docstring magenta-faint)
(docmarkup green-faint)
(fnname magenta-warmer)
(keyword cyan)
(preprocessor cyan-cooler)
(string red-cooler)
(type magenta-cooler)
(variable blue-warmer)
(rx-construct magenta-warmer)
(rx-backslash blue-cooler)))
The “alt-syntax” could optionally use green strings and yellow comments (Make comments yellow and strings green):
;; Same as above, but with yellow comments and green strings
(setq modus-themes-common-palette-overrides
'((builtin magenta)
(comment yellow-faint)
(constant magenta-cooler)
(docstring green-faint)
(docmarkup magenta-faint)
(fnname magenta-warmer)
(keyword cyan)
(preprocessor cyan-cooler)
(string green-cooler)
(type magenta-cooler)
(variable blue-warmer)
(rx-construct magenta-warmer)
(rx-backslash blue-cooler)))
The standard “alt-syntax” has red strings. As such, it is interesting to experiment with faintly red colored comments:
;; Like the old "alt-syntax" but with faint red comments
(setq modus-themes-common-palette-overrides
'((builtin magenta)
(comment red-faint)
(constant magenta-cooler)
(docstring magenta-faint)
(docmarkup green-faint)
(fnname magenta-warmer)
(keyword cyan)
(preprocessor cyan-cooler)
(string red-cooler)
(type magenta-cooler)
(variable blue-warmer)
(rx-construct magenta-warmer)
(rx-backslash blue-cooler)))
The user can always mix and match styles to their liking.
Make use of alternative styles for code syntax.
Reload the theme for changes to take effect.