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

Cannot enable solarized-dark #142

Closed ramLlama closed 9 years ago

ramLlama commented 9 years ago

When I run emacs terminal-only as env TERM=xterm-16color emacs -nw, I start in the solarized-light theme but cannot switch to solarized-dark. Here is an output of when I try to do so in the scratch buffer

(frame-parameter nil 'background-mode)
light
(set-frame-parameter nil 'background-mode 'dark)
nil
(frame-parameter nil 'background-mode)
dark
(enable-theme 'solarized)
nil
;; Nothing happens!
(frame-parameter nil 'background-mode)
light
;; It changed back?!

The only line I have to load solarized in my init.el is (load-theme 'solarized t). Also note that this issue does not occur in GUI/X mode!

My System:

sellout commented 9 years ago

Thanks for the great bug report!

Unfortunately, I don’t know why this happens. Someone reported the same behavior in #emacs on IRC a few days ago, and they said that it worked properly if they did emacs -Q and then manually loaded the theme, but I never heard back as to whether they deduced where the problem was. That gives some indication that the problem is not in solarized itself, but regardless, I’d at least like to know where it’s happening so I can maybe fix the offending package or at least warn other users.

crsmithdev commented 9 years ago

Same issue.

version: GNU Emacs 24.4.1 (x86_64-apple-darwin14.0.0) of 2014-11-06 on <...> terminal: iterm2

...works fine w/ emacs for osx.

crsmithdev commented 9 years ago

Actually it does occur if I try to open a new window for Emacs for OSX: the second one always loads w/ the light theme.

qinix commented 9 years ago

Same issue.

darfink commented 9 years ago

Same issue here as well (GNU Emacs 24.4.1, OS X, iTerm 2)

pyr commented 9 years ago

On archlinux and emacs 24.4.1 I can confirm the behavior.

pyr commented 9 years ago

After some digging, it looks as if the issue is directly related to load-theme, even without solarized the background-mode frame parameter gets reset. It'd be interesting to know if this is true for users of previous emacs versions as well to try and pinpoint when this happened.

pyr commented 9 years ago

Alright, after more digging I've reached a satisfying solution. The culprit is the recent way of handling terminal settings in emacs. You'll have to not only adjust your frame parameters but also your terminal parameters.

A good way of approaching this could be (assuming mode contains either 'light or 'dark)

   (set-frame-parameter nil 'background-mode mode)
   (when (not (display-graphic-p (selected-frame)))
      (set-terminal-parameter (frame-terminal frame) 'background-mode mode))
   (enable-theme 'solarized)

My full solution is here: https://github.com/pyr/dot.emacs/blob/master/customizations/40-theme.el

vsbuffalo commented 9 years ago

Same issue. @pyr's solution sadly doesn't seem to work.

$ emacs --version
GNU Emacs 24.3.50.1

Any ETA on when this issue might be resolved? I need to get stuff done, and I'd prefer not to use an editor color theme as bright as the sun.

Update: @jramnani's solution worked. Thanks!

fredcy commented 9 years ago

The fix by @pyr works for me. Thanks. Mac OS X: GNU Emacs 24.4.1 RHEL6: GNU Emacs 24.4.50.1 cygwin: GNU Emacs 24.4.1 mingw: GNU Emacs 24.3.1

finecrawler commented 9 years ago

The fix by @pyr works for me. Thanks. Iterm2 on Mac OS.

sellout commented 9 years ago

@ramLlama Since you’re the creator, I defer to you – is this ticket suitably resolved?

ramLlama commented 9 years ago

Ah, its been a while since I checked this out. I need to sleep now =) but I will test tomorrow and report back.

On Sun, Apr 26, 2015 at 11:43 PM, Greg Pfeil notifications@github.com wrote:

@ramLlama https://github.com/ramLlama Since you’re the creator, I defer to you – is this ticket suitably resolved?

— Reply to this email directly or view it on GitHub https://github.com/sellout/emacs-color-theme-solarized/issues/142#issuecomment-96489361 .

sellout commented 9 years ago

I’m going to assume this is fixed (it should be). But feel free to reopen if it’s not working for you.