Skip to content

Complete example of a private theme derived from Modus ​

If your derivative theme is not going to be distributed as a package (Complete example of a package that is derived from Modus), then create a directory where all custom themes are stored and add it to the custom-theme-load-path. For example, the ‘my-custom-themes’ directory can be included thus somewhere in the Emacs initialization file:

emacs-lisp
(add-to-list 'custom-theme-load-path (locate-user-emacs-file "my-custom-themes/"))

The function locate-user-emacs-file takes care to return a path relative to where the user’s init file is. If, say, we have ‘~/.emacs.d/init.el’ then we get ‘~/.emacs.d/my-custom-themes/’.

Create the directory in that path. Then for each derivative Modus theme, write a new file of the form ‘NAME-theme.el’. If, for instance, your theme is named ‘prot-light’ the file is called ‘prot-light-theme.el’.

At minimum, the contents of a theme file are these (Complete example of a custom theme with its own palette):

emacs-lisp
(modus-themes-theme
 'prot-light
 'prot-themes
 "My demo `prot-light' theme."
 'light
 'modus-operandi-palette
 nil
 nil)

Arrange to activate your derivative themes.