3.2 Sample configuration with and without use-package

What follows is a variant of what we demonstrate in the previous section (Enable and load).

It is common for Emacs users to rely on use-package for declaring package configurations in their setup. We use this as an example:

;;; For the built-in themes which cannot use `require'.
(use-package emacs
  :config
  (require-theme 'modus-themes) ; `require-theme' is ONLY for the built-in Modus themes

  ;; Add all your customizations prior to loading the themes
  (setq modus-themes-italic-constructs t
        modus-themes-bold-constructs nil)

  ;; Maybe define some palette overrides, such as by using our presets
  (setq modus-themes-common-palette-overrides
        modus-themes-preset-overrides-intense)

  ;; Load the theme of your choice.
  (load-theme 'modus-operandi)

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



;;; For packaged versions which must use `require'.
(use-package modus-themes
  :ensure t
  :config
  ;; Add all your customizations prior to loading the themes
  (setq modus-themes-italic-constructs t
        modus-themes-bold-constructs nil)

  ;; Maybe define some palette overrides, such as by using our presets
  (setq modus-themes-common-palette-overrides
        modus-themes-preset-overrides-intense)

  ;; Load the theme of your choice.
  (load-theme 'modus-operandi)

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

The same without use-package:

(require 'modus-themes) ; OR for the built-in themes: (require-theme 'modus-themes)

;; Add all your customizations prior to loading the themes
(setq modus-themes-italic-constructs t
      modus-themes-bold-constructs nil)

;; Maybe define some palette overrides, such as by using our presets
(setq modus-themes-common-palette-overrides
      modus-themes-preset-overrides-intense)

;; Load the theme of your choice:
(load-theme 'modus-operandi :no-confirm)

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

Differences between loading and enabling.

Note: make sure not to customize the variable custom-theme-load-path or custom-theme-directory after the themes’ package declaration. That will lead to failures in loading the files. If either or both of those variables need to be changed, their values should be defined before the package declaration of the themes.