guns / xterm-color-table.vim

All 256 xterm colors with their RGB equivalents, right in Vim!
http://github.com/guns/xterm-color-table.vim
383 stars 37 forks source link

Hardcoded Xterm defaults #1

Open trapd00r opened 13 years ago

trapd00r commented 13 years ago

Hello,

I just want to make you aware of the fact that the Xterm colors are not static. You can change all of them, and since your script uses hardcoded values, it'll get them wrong if they're modified.

Now, I don't know if it's possible for vim to somehow query the underlying terminal and get response back in a sensible way. There's escape sequences that ought to be used, but it's a bit tricky getting at the responses without blocking.

I've written a library [1] that provides two functions; set_xterm_color() for changing arbitary color indexes, and get_xterm_color() for getting at the values.

I've also written an application [2] that allows the user to manipulate the full colormap in interesting ways, as well as another simple application [3] that does nothing more but to give you the real color values for every color index back.

Perhaps looking at these might give some inspiration.

Furthermore, I was wondering if you'd allow me to use the Xorg color <=> Xterm color index mappings as listed here [4] in my Term::ExtendedColor [5] library? It's really, really hard to come up with meaningful names for all of these colors, and I'd like to offer your mappings as another way of getting at them.

You would of course be credited as appropriate.

1: https://github.com/trapd00r/Term-ExtendedColor-Xresources

2: https://github.com/trapd00r/colorcoke

3: https://github.com/trapd00r/rgbterm

4: http://vim.wikia.com/wiki/Xterm256_color_names_for_console_Vim

5: https://github.com/trapd00r/Term-ExtendedColor

guns commented 13 years ago

I just want to make you aware of the fact that the Xterm colors are not static. You can change all of them, and since your script uses hardcoded values, it'll get them wrong if they're modified.

...

Perhaps looking at these might give some inspiration.

Yes, this is very interesting. I have been content with the standard Xterm color scheme, but perhaps not for much longer!

At first glance, I suppose what I will do is detect whether the user's copy of vim has been compiled with perl support, and fall back on the hard coded values if not.

Should they have perl support and your Term-ExtendedColor-Xresources library installed, then I will query the true color settings via get_xterm_color().

Does that sound good to you?

Furthermore, I was wondering if you'd allow me to use the Xorg color <=> Xterm color index mappings as listed here [4] in my Term::ExtendedColor [5] library?

Ah, this one is easier to answer. I did not come up with those names; according to that page's revision history, the person you are looking for is Dr. Mohsin Ahmed.

Cheers, guns

trapd00r commented 13 years ago

If you can come up with a working solution using Term::ExtendedColor::Xresources it'd be awesome. Otherwise you might be able to send the raw escape sequences to the underlying tty, however, I'm afraid there'll be a blocking problem. But I dont know much of viml or what it's capable of.

On the subject; I saw you had done some work on rxvt-unicode; I recently added a repo that adds support for redefining all of them colors using X resources, if you want to try it out.

Thanks for the link.

Cheers