Open hai-nguyen-van opened 9 years ago
I'm having the same issue here. Although I've installed from MELPA.
Anyone know if this is the right syntax, or this is a bug?
Also, I remember that in past versions, it was possible to change from light do dark (or vice-versa) just with M-x color-theme-solarized-dark
for example. This is not working anymore. Is this a desirable feature, or do we have to set something?
Ok, this seems to be related to #142 .
I've managed to get the theme switching working with the solution from @pyr. I've placed the lines in:
https://github.com/pyr/dot.emacs/blob/master/customizations/40-theme.el
In my .emacs
and everything runs fine now.
There is a much simpler way to set light versus dark, as this theme takes advantage of frame-background-mode
(which hooks into the customize system to set things correctly).
(require 'color-theme-solarized)
(customize-set-variable 'frame-background-mode 'light)
(load-theme 'solarized t)
I know this is a bad way to do this, but I just scratched some tips from Mastering Emacs together with @andschwa's commands to quickly get this functionality behind keybindings (didn't need the require
since I'm in in Emacs24).
(defun set-solarized-light ()
(interactive)
(customize-set-variable 'frame-background-mode 'light)
(load-theme 'solarized t))
(defun set-solarized-dark ()
(interactive)
(customize-set-variable 'frame-background-mode 'dark)
(load-theme 'solarized t))
;; color theme
(global-set-key (kbd "C-c l") 'set-solarized-light)
(global-set-key (kbd "C-c d") 'set-solarized-dark)
If I knew enough Elisp, I'd make it a single keybinding that checks what the current background mode is and then switch it to the other one...
Oh, something like this, @metakermit
(defun toggle-night-color-theme ()
"Switch to/from night color scheme."
(interactive)
(if (eq frame-background-mode 'dark)
(setq frame-background-mode 'light)
(setq frame-background-mode 'dark))
(load-theme 'solarized)
(mapc 'frame-set-background-mode (frame-list)))
This is what I use (but I removed some special hacks for powerline and pdf-view). Perhaps the solution here is more comprehensive: https://github.com/pyr/dot.emacs/blob/master/customizations/40-theme.el. It seems to take terminals into account as well, as I can judge from a quick glance.
That's just what I needed. Thanks a bunch, @andersjohansson!
Hello, I am not a confirmed user of Emacs init configuration files. I tried to add the following lines to get the light theme version of Solarized but was unable to get the light. I only get the dark one with an error message. Is this syntax correct ?
Regards,