On Nov 12, 2007 5:41 AM, Matt Wozniski <[EMAIL PROTECTED]> wrote:
> So, I would certainly welcome some advice on how querying
> can be done reasonably...
>
> Gnome-terminal and Konsole, at least, do not seem to be able
> to report back their colors...  So, I guess one (pseudocode)
> approach is...
>
> if $TERM =~ 'screen'
>   prefix = "\eP"
>   suffix = "\e\\"
> endif
>
> resp = send_query(prefix + "\e]4;17;?\007" + suffix)
>
> if resp != ""
>   palette = query_active_palette() # Repeatedly calls send_query
> else
>   # No answer: assume default based on &t_Co
>   if &t_Co == 88
>     palette = default_urxvt
>   else
>     if $KONSOLE_DCOP_SESSION == ""
>       palette = default_xterm_gnome_terminal_putty
>     else
>       palette = default_konsole_rxvt
>     endif
>   endif
> endif
>
> Any thoughts?

After spending a long time experimenting with this, I've come to two
conclusions:
1) It's prohibitively difficult to query the terminal emulator for
available colors on its colorcube, especially given that many terminal
don't support querying.  Given this fact, I feel that the best thing
that we can do is to hardcode in the known palettes and add an option
to vim allowing you to choose which one your terminal emulator
supports.
2) There is no algorithm available to programmatically judge the
perceived differences between colors that suits our purposes.  We do
well with CIE L*a*b*, but not better than the stepping algorithm I
proposed first, and in some places drastically worse.  Unfortunately,
CIE L*a*b* is only good at measuring the perceived differences between
relatively similar colors, where the steps on our color cube are far
enough apart that the colors are often not "similar" enough.

So, I've reworked the patch to support, in addition to the
xterm-compatible palette, Eterm and Konsole's palettes.  Which palette
is used for the matching is controlled by a new option, 'termpalette'
(short name 'tpal').  If the option is unset, I default to an xterm
palette, but display a warning that color matching might be
unaccurate.

For those interested, a comparison between the 3 palettes that I've
found so far can be seen here:
http://www.cs.drexel.edu/~mjw452/256.html

So, I'd appreciate comments.  The reworked patch can be found:
http://www.cs.drexel.edu/~mjw452/ctermrgb-src.diff (source, against SVN)
http://www.cs.drexel.edu/~mjw452/ctermrgb-runtime.diff (runtime,
against latest AAP)

And, the two modified colorschemes for testing are available at
http://www.cs.drexel.edu/~mjw452/brookstream-rgb.vim and
http://www.cs.drexel.edu/~mjw452/autumnleaf-rgb.vim ; it should be
trivial to modify other colorschemes in this way.

Please comment!
~Matt

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui