Mattias
Mattias

Reputation: 725

Can't import colors to terminal.app in OS X Yosemite (solarized for terminal vim)

I've been struggling with this for hours today and it's really driving me crazy. I just installed mathiasbynens dotfiles and I am trying to get my terminal vim to use the solarized color theme (that comes with the dotfiles). Macvim works fine, but terminal vim uses the ansi color palette. From the solarized home page:

If you are going to use Solarized in Terminal mode (i.e. not in a GUI version like gvim or macvim), please please please consider setting your terminal emulator’s colorscheme to used the Solarized palette. I’ve included palettes for some popular terminal emulator as well as Xdefaults in the official Solarized download available from Solarized homepage. If you use Solarized without these colors, Solarized will need to be told to degrade its colorscheme to a set compatible with the limited 256 terminal palette (whereas by using the terminal’s 16 ansi color values, you can set the correct, specific values for the Solarized palette).

I have imported the osx-terminal.app-colors-solarized from the solarized download (both the xterm-256color version and the ansi version. They change some things in the terminal (like color for text, bold text, marking and pointer) but they don't change the ansi colors themselves that are used by vim (blue, red etc...).

Shouldn't they do this? Am I doing something wrong?

In the files on the github page for the terminal.app solarized colors it looks like they should change ansi colors. For example:

<key>brightYellowColour</key>
<data>
BAtzdHJlYW10eXBlZIHoA4QBQISEhAdOU0NvbG9yAISECE5TT2JqZWN0AIWEAWMBhARm
ZmZmg1MTpj6DeHnQPoPQg+A+AYY=
</data>

Someone please help me understand this. What is the difference between xterm-256color and ansi? Can the ansi colors become any color (looks like it in the terminal settings)? Why would you then even need xterm-256color?

I am very thankful for any answers.

Upvotes: 1

Views: 1756

Answers (2)

Mattias
Mattias

Reputation: 725

Well, this terminal theme seems to have solved it. It changed the ansi colors as expected. Strange though that he refers to the main solarize download:

If you have come across this colorscheme via the OS X Terminal.app repository on github, see the link above to the Solarized homepage or visit the main Solarized repository.

since that one doesn't work.

Upvotes: 0

romainl
romainl

Reputation: 196886

All of the colors used in Solarized are outside of the xterm palette you get access to when you set your TERM to xterm-256color.

This means two things:

  • Solarized will look as it should in GVim or MacVim,
  • Solarized will look like shit in Terminal.app if you TERM is *256color which will force you to use dirty hacks to "downgrade" to 16 colors.

The only sane way to get that pile of crap to work properly and non-magically in a terminal emulator is thus to:

  • define the 16 so-called "ANSI" colors as per the Solarized specifications,
  • make sure your TERM is not xterm-256color.

And that will be my last attempt ever to try to help a victim of the Solarized craze.

Upvotes: 1

Related Questions