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

Many "Unable to load color" messages when loading #175

Closed fredcy closed 8 years ago

fredcy commented 8 years ago

My emacs Messages\ buffer has many messages like this when loading the solarized theme.

Unable to load color "brightyellow" [8 times]
Unable to load color "brightwhite" [2 times]
Unable to load color "brightyellow" [2 times]
Unable to load color "brightwhite"
Unable to load color "brightyellow"

These happen only when running in an iterm2 terminal, not when running Emacs.app. I installed emacs with homebrew on Mac OS X 10.10.5.

Here is the init code I'm using:

(add-to-list 'custom-theme-load-path "~/.emacs.d/emacs-color-theme-solarized")
(load-theme 'solarized t)

(defun setup-background (frame)
  (let* ((background (if (display-graphic-p frame) 'light 'dark)))
    (message "setup-background(%s): %s" frame background)
    (set-frame-parameter frame 'background-mode background)
    (set-terminal-parameter (frame-terminal frame) 'background-mode background))
  (enable-theme 'solarized))

;;; Set up background of initial frame
(mapc 'setup-background (visible-frame-list))
lifepillar commented 8 years ago

I have exactly the same problem, just with Terminal.app instead of iTerm. In fact, I am using color-theme-solarized from MELPA, which I believe is the same as this project. I have tried to require color-theme before loading the theme, but that does not change anything. I have installed Emacs with Homebrew (emacs-mac formula from the railwaycat/emacsmacport tap).

It is worth mentioning that, despite those errors, the theme seems to look ok even in the terminal (but I have not tested it much).

sellout commented 8 years ago

Try setting solarized-termcolors to 256 rather than (the default) 16. I should try to make this variable smarter – some 256-color terms actually do support the named colors in addition to the standard 256, others don’t. And the named colors are more correct if they’re available.

fredcy commented 8 years ago

I added (customize-set-variable 'solarized-termcolors 256) and now I no longer see any of the "Unable to load color" messages, so that does the trick. Thanks.

(I thought I had tried that before. Perhaps I was not setting solarized-termcolors the right way or in the right place.)

jasonm23 commented 8 years ago

Just for reference this error seems to be sent whether the terminal recognizes the color name or not.

The reason setting solarized-termcolors to 256 solves the problem is because the color values used are hex color strings instead of color names.

As long as the target terminal recognizes a color name, it will be set correctly. (the Emacs error message will still show of course, but it's a false report.)