Matt Wozniski wrote:
> On Sun, Feb 15, 2009 at 8:19 AM, Stahlman Family wrote:
>> Stahlman Family wrote:
>>> Matt Wozniski wrote:
>>>> On Sat, Feb 14, 2009 at 9:00 AM, Brett Stahlman wrote:
>>>>> Note that both evening and morning colorschemes hide Ignore characters
>>>>> completely with the following settings...
>>>>> evening:
>>>>>    Ignore ctermfg=242
>>>>> morning:
>>>>>    Ignore ctermfg=7
>>>>> ...which set ctermfg to the same number used for ctermbg in the Normal
>>>>> group. I suppose I can use the brute-force approach: i.e., parse the
>>>>> output of ":hi Normal" and extract the ctermfg value...
>>>> Like I said, that isn't enough.  Most terminals (Konsole being the
>>>> only exception I know of) only allow you to set the foreground or
>>>> background color for some text to one of, at most, 256 specific
>>>> colors.  They allow you to set the *default* foreground or background
>>>> color to one of 16777216 colors.  So, the odds are against the user's
>>>> choice of background color even being able to be set with a
>>>> ctermbg=[0-255].
>>> I'm not sure I understand the distinction between a terminal's "default"
>>> background, and the background colors to which text can be set. Are you
>>> saying that the terminal could have a certain background color where no
>>> text appears, but that a program such as vim wouldn't be able to output
>>> text with that color to the terminal?
> 
> This one.  The user could set their terminal up to have a background
> color of, say, #00002F - a dark blue.  But, there's no color on the
> xterm color cube particularly close to that.  The closest you can get
> (depending on how you approximate) are colors like #00005F (xterm
> color 17), #5F005F (xterm color 53), #121212 (xterm color 233), etc.
> 
>> Or perhaps you are simply saying that the format of the default color
>> setting (e.g., in an Xresource file) supports greater resolution than
>> what is supported by the terminal itself,
> 
> Depending on what you mean by "by the terminal itself"...  For
> example, in xterm - and I'm willing to bet it works this way in every
> modern xterm clone - there are 260-ish colors that can show up: The
> default foreground color, the default background color, the cursor
> color, the mouse color, the highlighted-text color, etc.  Of these,
> vim only gives you a way to select the 256 on the color cube
> (ctermfg=123 or ctermbg=255), or set the background color to the
> default background color (ctermbg=NONE), or set the foreground color
> to the default foreground color (ctermfg=NONE).  There's no way to
> tell vim to set the background color to the default foreground color,
> or vice versa - and there's no reason to expect that the default
> background or foreground color are on the color cube.

I believe I've got it now. I reread this after responding to Tony's 
email, and one of the remaining questions I had (whether Vim could 
request background color equal to default when the default doesn't 
correspond to one of the colors on the "cube") was answered. Since 
there's no way to request that foreground be set to the default 
background, it is not always possible to hide text completely. I 
suspect, though, that the color on the color cube "nearest" to the 
default background would typically be close enough (especially in 256 
color terminals) effectively to hide the text. Unfortunately, I'm 
beginning to suspect that there's not an easy way to determine the 
default background color from within a Vim script. Even if the default 
background color could be determined, it would need to be converted to 
the nearest color on the color cube, which would depend upon number of 
colors (which could be presumably be determined from &t_Co), and perhaps 
something else...

Thanks,
Brett Stahlman

> 
>> in which case, Vim could not
>> use the X resource database to determine the actual background color of
>> the terminal.
> 
> Nothing to do with this at all, just with how to tell the terminal
> what color it should use...
> 
> ~Matt
> 
> > 
> 

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

Reply via email to