Is vim supporting 24 bit colors?

933 views
Skip to first unread message

KiYugadgeter

unread,
Sep 23, 2016, 12:18:05 AM9/23/16
to vim_use
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?

Christian Brabandt

unread,
Sep 23, 2016, 3:04:25 AM9/23/16
to vim_use
Hi KiYugadgeter!

On Do, 22 Sep 2016, KiYugadgeter wrote:

> Is vim supporting 24 bit colors?

Yes, see :h 'termguicolors'

> I want to use vim on windows10 bash.
>
> windows 10 bash is supporting 24bit colors on beta version.

Are you sure?


Best,
Christian
--
Ehrungen, das ist, wenn die Gerechtigkeit ihren guten Tag hat.
-- Konrad Adenauer

Nikolay Aleksandrovich Pavlov

unread,
Sep 23, 2016, 4:22:26 AM9/23/16
to vim...@googlegroups.com
2016-09-23 5:26 GMT+03:00 KiYugadgeter <zyouho...@gmail.com>:
> Is vim supporting 24 bit colors?
>
> I want to use vim on windows10 bash.
>
> windows 10 bash is supporting 24bit colors on beta version.

Bash cannot possibly support 24-bit colors, it is a shell and not a
terminal emulator and thus is not responsible for rendering. I know
that ConEmu on Windows should support this by now, but support was
added rather long ago and it should not be in beta. So wondering what
terminal emulator did you mean?

>
> Will vim support 24bit colors?
>
> --
> --
> 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+u...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Ken Takata

unread,
Sep 23, 2016, 2:01:10 PM9/23/16
to vim_use
Hi,

2016/9/23 Fri 16:04:25 UTC+9 Christian Brabandt wrote:
> Hi KiYugadgeter!
>
> On Do, 22 Sep 2016, KiYugadgeter wrote:
>
> > Is vim supporting 24 bit colors?
>
> Yes, see :h 'termguicolors'
>
> > I want to use vim on windows10 bash.
> >
> > windows 10 bash is supporting 24bit colors on beta version.
>
> Are you sure?

See this:
https://blogs.msdn.microsoft.com/commandline/2016/09/22/24-bit-color-in-the-windows-console/

Regards,
Ken Takata

Tony Mechelynck

unread,
Sep 24, 2016, 12:05:19 AM9/24/16
to vim...@googlegroups.com
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?

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.


Best regards,
Tony.

Nikolay Aleksandrovich Pavlov

unread,
Sep 24, 2016, 11:40:54 AM9/24/16
to vim...@googlegroups.com
2016-09-24 7:05 GMT+03:00 Tony Mechelynck <antoine.m...@gmail.com>:
> On Fri, Sep 23, 2016 at 4:26 AM, KiYugadgeter <zyouho...@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.

>
> 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.
>
>
> Best regards,
> Tony.
>

Tony Mechelynck

unread,
Sep 24, 2016, 12:04:41 PM9/24/16
to vim...@googlegroups.com
On Sat, Sep 24, 2016 at 5:40 PM, Nikolay Aleksandrovich Pavlov
<zyx...@gmail.com> wrote:
> 2016-09-24 7:05 GMT+03:00 Tony Mechelynck <antoine.m...@gmail.com>:
>> On Fri, Sep 23, 2016 at 4:26 AM, KiYugadgeter <zyouho...@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.

Nikolay Aleksandrovich Pavlov

unread,
Sep 24, 2016, 8:17:27 PM9/24/16
to vim...@googlegroups.com
I was false when saying that you can’t set &t_Co to such value, but
this does not change the key point: terminals which support 24-bit
colors use different escape sequences for expressing such colors. So
you will not see such a high value in termcap/terminfo.

I also would not be surprised to hear that some software is written in
a way so that it supports only no more then three digits in Co
termcap/terminfo entry.

>>
>>>
>>> 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.
>
Reply all
Reply to author
Forward
0 new messages