Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hardcoded Xterm defaults #1

Open
trapd00r opened this issue Feb 17, 2011 · 2 comments
Open

Hardcoded Xterm defaults #1

trapd00r opened this issue Feb 17, 2011 · 2 comments

Comments

@trapd00r
Copy link

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
Copy link
Owner

guns commented Feb 17, 2011

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
Copy link
Author

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

padawin added a commit to padawin/xterm-color-table.vim that referenced this issue Oct 13, 2019
If the match is executed based on the hard coded color (which should not
be hard coded in the first place, mentioned in issue guns#1), a color code
can have multiple matches if the hex code is used for multiple colors.

This commit changes the matching as: ' \d+ #[0-9af]+', containing the
xterm256 index of the color, so that the highlight class is independant
from the used RGB code.
shmup referenced this issue in shmup/xterm-color-table.vim Aug 21, 2022
If the match is executed based on the hard coded color (which should not
be hard coded in the first place, mentioned in issue #1), a color code
can have multiple matches if the hex code is used for multiple colors.

This commit changes the matching as: ' \d+ #[0-9af]+', containing the
xterm256 index of the color, so that the highlight class is independant
from the used RGB code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants