Search code examples
emacsthemesdot-emacs

Emacs 29.2 unable to find theme file


I'd like to preface this post by saying that I am VERY new to Emacs.

So I have themes installed using package.el and have already verified that they are installed by running package-activated-list). Checking my .emacs.d/elpa directory, the theme files of the different themes I've tried to install are also located within their own respective directories.

~/.emacs.d/elpa$ ls
adwaita-dark-theme-20231209.1033  archives  constant-theme-20180921.1012  gnupg  timu-macos-theme-20240302.1736

I also already have my package.el initialized through:

;; package manager
(require 'package)
(setq package-archives
      '(("gnu" . "https://elpa.gnu.org/packages/")
    ("melpa" . "https://melpa.org/packages/")))
(package-initialize)

However when I evaluate the following region from my .emacs.d/init.el, an error message is returned saying that Emacs is unable to find the theme file.

(unless (package-installed-p 'adwaita-dark-theme)
  (package-refresh-contents)
  (package-install 'adwaita-dark-theme))

(load-theme 'adwaita-dark-theme t)

So I've tried installing other themes to check if maybe it was something wrong with the theme source. I first tried installing the timu-macos theme and then adwaita-dark-theme. These packages were installed by changing the theme name I used in the third code snippet I provided. I've also tried installing from package-list-packages within Emacs but as with the others, the theme file could not be found.

I've also tried manually add the theme file to the load-path to no avail.

(add-to-list 'load-path "~/.emacs.d/elpa/adwaita-dark-theme-20231209.1033/adwaita-dark-theme.el")

Any help provided would be much appreciated!


Solution

  • This theme's package name is adwaita-dark-theme, but the theme's name is adwaita-dark.

    So, the correct way to load this theme after the wrapping package is successfully installed is to call the following:

    (load-theme 'adwaita-dark t)