Function: treemacs-create-theme

treemacs-create-theme is a macro defined in treemacs-themes.el.

Signature

(treemacs-create-theme NAME &key ICON-DIRECTORY EXTENDS CONFIG)

Documentation

Create a new (bare) theme with the given NAME.

- ICON-DIRECTORY is the (mandatory) theme's location.
- EXTENDS is the theme to be extended.
- CONFIG is a code block to fill the created theme with icons via
  treemacs-create-icon.

Source Code

;; Defined in ~/.emacs.d/elpa/treemacs-20251226.1307/treemacs-themes.el
(cl-defmacro treemacs-create-theme (name &key icon-directory extends config)
  "Create a new (bare) theme with the given NAME.
- ICON-DIRECTORY is the (mandatory) theme's location.
- EXTENDS is the theme to be extended.
- CONFIG is a code block to fill the created theme with icons via
  `treemacs-create-icon'."
  (declare (indent 1))
  `(let* ((gui-icons (make-hash-table :size 300 :test 'equal))
          (tui-icons (make-hash-table :size 300 :test 'equal))
          (theme (treemacs-theme->create!
                  :name ,name
                  :path ,icon-directory
                  :gui-icons gui-icons
                  :tui-icons tui-icons)))
     (add-to-list 'treemacs--themes theme)
     ,(when extends
        `(treemacs-unless-let (base-theme (treemacs--find-theme ,extends))
             (treemacs-log-failure "Could not find base theme %s when creating theme %s." ,extends ,name)
           (treemacs--maphash (treemacs-theme->gui-icons base-theme) (ext icon)
             (ht-set! gui-icons ext icon))
           (treemacs--maphash (treemacs-theme->tui-icons base-theme) (ext icon)
             (ht-set! tui-icons ext icon))))
     (-let [treemacs--current-theme theme]
       ,config
       (treemacs--propagate-new-icons theme))
     ,name))