I would like to switch from 'solarized-dark (with my theme by default) to 'solarized-light when typing LATEX or Markdown. I'm using Emacs 24 and solarized from https://github.com/sellout/emacs-color-theme-solarized.
In my custom.el, I wrote the following lines :
(add-to-list 'custom-theme-load-path (make-plugin-path "color-theme-solarized"))
(load-theme 'solarized 1)
(add-hook 'markdown-mode-hook
(lambda (frame)
(set-frame-parameter frame 'background-mode 'light))
)
But it doesn't work properly, i.e. loading a .md file does not make Emacs switch from 'dark to 'light solarized theme.
Try this:
(add-hook 'markdown-mode-hook
(lambda ()
(set-frame-parameter (window-frame) 'background-mode 'dark)
(enable-theme 'solarized)))
The main changes are calling window-frame
to get the current frame and then enable-theme
to make it active.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With