On Thu, 04 May 2023 15:48:43 +0100
Bram Moolenaar <b...@moolenaar.net> wrote:
> > For the value 7, ctermfg and ctermbg gives different colors. 'ctermfg=7'
> > gives non-bold white, which is expected.  But 'ctermbg=7' gives bold
> > Black color.  I'm assuming there is a if-conditional somewhere that's
> > causing this distinction.  If so, where is the conditional in the source
> > code?  If not, why is this happening?
>
> Color support depends on the terminal.  Background and foreground
> settings are often different, especially with older terminals and a low
> number of colors supported.  Sometimes the "bold" flag changes the color
> between a darker and lighter color.  You can find some information at
> ":help highlight-ctermfg".

I shouldn't have said "bold black."  That caused unnecessary confusion.
The 'cterm=' value is NONE.  I was just trying to say "darker" shade of
black.

> > P.S.  I'm on Windows.  I have a Linux laptop but haven't checked if this
> > behavior is reproducible on that OS.

I checked on my Linux laptop.  These are the behaviors:

highlight   | Linux         | Windows
------------+---------------+-------------
ctermfg=0   | Black         | Black
ctermfg=7   | White         | Black
ctermfg=8   | Bright black  | Bright black
ctermfg=15  | Bright white  | Bright white

I run Windows Terminal on Windows and Suckless Terminal on Linux. The
colors in my WT are set in a JSON file, with 16 keys. But the colors in
my ST is a C array of strings, and the indices match with Vim's behavior
of 'ctermfg=<index>', i.e., 'ctermfg=0' is black and 'ctermfg=8' brblack
(that's how it's named in the comments in ST's source code [1]).

The fun part is: I ssh'd into my Linux laptop from my Windows laptop.
Meaning, I ran Vim on the Linux machine but in WT.  There, 'ctermfg=7'
still showed White, unlike the Vim on native Windows.  Seems like WT
does show 'ctermfg=7' as white, but the 'builtin_win32' term isn't
supplying WT with proper whatchamacallit.  (I'm probably wrong. This was
just a guess.)

[1]: 
https://github.com/3N4N/st/blob/5dc3385bfce0e25d04942d2e0d9af8f9ba94d70b/config.h#L96-L114

--
Enan

-- 
-- 
You received this message from the "vim_dev" 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_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20230504232702.00004caf%40gmail.com.

Raspunde prin e-mail lui