sellout / emacs-color-theme-solarized

Emacs highlighting using Ethan Schoonover’s Solarized color scheme
http://ethanschoonover.com/solarized
MIT License
1.15k stars 201 forks source link

Unable to switch to light Solarized theme #167

Open hai-nguyen-van opened 9 years ago

hai-nguyen-van commented 9 years ago

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 ?

(setq load-path (append load-path '("/home/me/.local/emacs-color-theme-solarized")))
(require 'color-theme-solarized)
(color-theme-solarized)

(set-frame-parameter nil 'background-mode 'light)
(enable-theme)

Regards,

fernandomayer commented 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?

fernandomayer commented 9 years ago

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.

andyleejordan commented 9 years ago

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)
metakermit commented 8 years ago

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...

andersjohansson commented 8 years ago

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.

metakermit commented 8 years ago

That's just what I needed. Thanks a bunch, @andersjohansson!