3 Enable and load

Users of the built-in themes cannot require the package as usual because there is no package to speak of. Instead, things are simpler as all one needs is to load the theme of their preference by adding either form to their init file:

(load-theme 'modus-operandi)            ; Light theme
(load-theme 'modus-vivendi)             ; Dark theme

Users of packaged variants of the themes must add a few more lines to ensure that everything works as intended. First, one has to require the main library before loading either theme:

(require 'modus-themes)

Then it is recommended to load the individual theme files with the helper function modus-themes-load-themes:

;; Load the theme files before enabling a theme (else you get an error).
(modus-themes-load-themes)

Once the libraries that define the themes are enabled, one can activate a theme with either of the following expressions:

(modus-themes-load-operandi)            ; Light theme
;; OR
(modus-themes-load-vivendi)             ; Dark theme

Changes to the available customization options must always be evaluated before loading a theme (Customization Options). An exception to this norm is when using the various Custom interfaces or with commands like M-x customize-set-variable, which can optionally automatically reload the theme (Option for inhibiting theme reload).

This is how a basic setup could look like:

;;; For the built-in themes which cannot use `require':
;; Add all your customizations prior to loading the themes
(setq modus-themes-italic-constructs t
      modus-themes-bold-constructs nil
      modus-themes-region '(bg-only no-extend))

;; Load the theme of your choice:
(load-theme 'modus-operandi) ;; OR (load-theme 'modus-vivendi)

(define-key global-map (kbd "<f5>") #'modus-themes-toggle)



;;; For packaged versions which must use `require':
(require 'modus-themes)

;; Add all your customizations prior to loading the themes
(setq modus-themes-italic-constructs t
      modus-themes-bold-constructs nil
      modus-themes-region '(bg-only no-extend))

;; Load the theme files before enabling a theme
(modus-themes-load-themes)

;; Load the theme of your choice:
(modus-themes-load-operandi) ;; OR (modus-themes-load-vivendi)

(define-key global-map (kbd "<f5>") #'modus-themes-toggle)

Sample configuration with and without use-package.

With those granted, bear in mind a couple of technical points on modus-themes-load-operandi and modus-themes-load-vivendi, as well as modus-themes-toggle which relies on them:

  1. Those functions call load-theme. Some users prefer to opt for enable-theme instead (Differences between loading and enabling).
  2. The functions will run the modus-themes-after-load-theme-hook as their final step. This can be employed for bespoke configurations (Advanced customization). Experienced users may not wish to rely on such a hook and the functions that run it: they may prefer a custom solution (A theme-agnostic hook for theme loading).