简体   繁体   English

无法将颜色导入OS X Yosemite中的terminal.app(针对终端vim进行了解析)

[英]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). 我刚刚安装了mathiasbynens点文件,并且试图使终端vim使用日光化的颜色主题(该点文件随附)。 Macvim works fine, but terminal vim uses the ansi color palette. Macvim工作正常,但终端vim使用ansi调色板。 From the solarized home page: 从太阳能首页:

If you are going to use Solarized in Terminal mode (ie not in a GUI version like gvim or macvim), please please please consider setting your terminal emulator's colorscheme to used the Solarized palette. 如果要在终端模式下使用Solarized(即不在诸如gvim或macvim的GUI版本中)使用,请考虑将终端仿真器的配色方案设置为使用Solarized调色板。 I've included palettes for some popular terminal emulator as well as Xdefaults in the official Solarized download available from Solarized homepage. 我在Solarized主页的官方Solarized下载中包含了一些流行的终端仿真器的调色板以及Xdefaults。 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). 如果您使用没有这些颜色的Solarized,则需要告知Solarized将其颜色方案降级为与有限256端子调色板兼容的设置(而通过使用端子的16 ansi颜色值,您可以为Solarized设置正确的特定值调色板)。

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...). 我已经从solarized下载文件(xterm-256color版本和ansi版本)中导入了osx-terminal.app-colors-solarized ,它们更改了终端中的某些内容(例如文本的颜色,粗体文本,标记和指针),但是它们本身不会更改vim使用的ansi颜色(蓝色,红色等)。

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. terminal.appgithub页面上的文件中, 日晒的颜色看起来应该改变ansi的颜色。 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? xterm-256color和ansi有什么区别? Can the ansi colors become any color (looks like it in the terminal settings)? ansi颜色可以变成任何颜色(在终端设置中看起来像)吗? Why would you then even need xterm-256color? 那么,您为什么甚至需要xterm-256color?

I am very thankful for any answers. 我非常感谢您的任何回答。

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 . TERM设置为xterm-256color时,可以在Solarized中使用的所有颜色都不 xterm调色板中。

This means two things: 这意味着两件事:

  • Solarized will look as it should in GVim or MacVim, Solarized的外观将与GVim或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. 如果您的TERM*256color*256color在Terminal.app中看起来像狗屎,这将迫使您使用肮脏的技巧将其“降级”为16种颜色。

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, 根据Solarized规格定义16种所谓的“ ANSI”颜色,
  • make sure your TERM is not xterm-256color . 确保您的TERM 不是 xterm-256color

And that will be my last attempt ever to try to help a victim of the Solarized craze. 这将是我有史以来最后一次尝试帮助日晒狂热的受害者的尝试。

Well, this terminal theme seems to have solved it. 好吧, 这个终端主题似乎已经解决了。 It changed the ansi colors as expected. 它按预期更改了ansi颜色。 Strange though that he refers to the main solarize download: 奇怪的是,他指的是主要的solarize下载:

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. 如果您通过github上的OS X Terminal.app存储库遇到了这个颜色图,请参见上方指向Solarized主页的链接,或访问主要的Solarized存储库。

since that one doesn't work. 因为那是行不通的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM