Reputation: 3584
I installed emacs, created a .emacs.d directory and made an init.el file:
(require 'package)
(add-to-list 'package-archives
'("melpa" . "http://melpa.milkbox.net/packages/") t)
(package-initialize)
(when (not package-archive-contents)
(package-refresh-contents))
(defvar my-packages
'(starter-kit
starter-kit-bindings
starter-kit-lisp
clojure-mode
color-theme
nrepl))
(dolist (p my-packages)
(when (not (package-installed-p p))
(package-install p)))
(require 'color-theme)
(color-theme-initialize)
(color-theme-charcoal-black)
(color-theme-install-frame-params '((background-color . "black")))
When I open emacs, I end up with the color-theme-charcoal-black
colors, with its default gray background. If I open init.el and eval-buffer
, the background goes black as desired.
How can I get that affect without needing to eval-buffer
?
I also tried:
(add-hook 'after-init-hook
'(lambda () (color-theme-install-frame-params
'((background-color . "black"))))
Similar to this question: https://superuser.com/questions/481793/permanently-override-background-colour-of-emacs-theme
Upvotes: 5
Views: 2661
Reputation:
Well, that's not the way to set up a theme in Emacs 24, but you could patch the old one to work like the new one. Here's an example of a theme I've made for myself, but you could just take the one that you like and replace the values. I've not finished this one yet, but it is close to be finished :)
After you've done, save the file into ~/.emacs.d/themes/charcoal-black-theme.el
and in your .emacs:
(add-to-list 'custom-theme-load-path (expand-file-name "~/.emacs.d/themes/"))
(setq custom-enabled-themes '(charcoal-black))
after you've done so, Emacs will ask you whether you want to permanently add the themes directory and the theme to enabled themes. If you answer positively, it will append some code to the (custom-set-variables ...)
The example theme follows:
Upvotes: 2