Saturday, September 24, 2016

Re: Is vim supporting 24 bit colors?

On Sat, Sep 24, 2016 at 5:40 PM, Nikolay Aleksandrovich Pavlov
<zyx.vim@gmail.com> wrote:
> 2016-09-24 7:05 GMT+03:00 Tony Mechelynck <antoine.mechelynck@gmail.com>:
>> On Fri, Sep 23, 2016 at 4:26 AM, KiYugadgeter <zyouhousikaku@gmail.com> wrote:
>>> Is vim supporting 24 bit colors?
>>>
>>> I want to use vim on windows10 bash.
>>>
>>> windows 10 bash is supporting 24bit colors on beta version.
>>>
>>> Will vim support 24bit colors?
>>
>> Vim supports between 2 (2^1) and 16777216 (2^24) colors, depending on
>> how many _it can tell that_ your terminal supports. This is set by the
>> termcap variable t_Co or by the equivalent terminfo setting, and these
>> settings depend in turn on the 'term' setting (q.v.) If $TERM is not
>> set, and Vim has no way of knowing otherwise, it will set an
>> OS-dependent 'term' default: for 32- or 64-bit Windows, 'term'
>> defaults to "win32". To see the number of colours Vim thinks that your
>> terminal supports, use
>> :set t_Co?
>
> &t_Co will never give you 24-bit value. Also termcap/terminfo do not
> normally contain information about 24-bit colors support, though tmux
> developers has selected some custom setting they use to detect 24-bit
> support. Vim AFAIK does not use it.

You can set t_Co yourself early in the vimrc (before any of the following:
runtime vimrc_example.vim
source $VIMRUNTIME/vimrc_example.vim
" or the same for defaults.vim
syntax on
syntax enable
colorscheme something-or-other
) and it will stick. The problem is how to set ctermfg= and ctermbg=
values for the desired colors, since the correspondence between GUI
#rrggbb color values and cterm color indices is usually opaque.

I just tried the following in a Huge gui-enabled Vim running in console mode:
set t_Co=16777216 t_Co?
and it answered
t_Co=16777216
so it _is_ possible to set that high a value. What I don't know is
which terminals, if any, really support that many colors, nor how to
use them, and AFAIK no pre-programmed colorscheme uses that many
colors for ctermfg= ctermbg=
>
>>
>> For me, 256 colors are good enough, and once I set up my vimrc to make
>> Vim use (as closely as possible) the same colors in a console and in
>> the GUI, I can't tell the difference by the naked eye. See
>> http://vim.wikia.com/wiki/Using_GUI_color_settings_in_a_terminal
>>
>> See also ":help term.txt", especially the first two sections.

I stand by the above two paragraphs.
>>
>>
>> Best regards,
>> Tony.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment