On Fri, 05 May 2023 02:36:41 +0100
Bram Moolenaar <[email protected]> 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
>
> So what is the number of colors, set with the t_Co option in each
> case?
>
> > 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.
>
> Not sure what this means.  Do you manually specify colors for the
> Windows Terminal?  Obviously Vim cannot know what these colors are.
>
> For "ctermfg-7" the color should probably "grey", neither white or
> black.  "Bright white" is just white, nothing is brighter than that.
> "Bright black" is some kind of grey.
>
> > 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]).
>
> I don't understand any of this.  If this is about a terminal with 8 or
> 16 colors, better follow the standard colors.  Vim will not be able to
> handle any manually configured colors.

I'm not an expert on terminal emulators, so this may be incorrect, but
as far as I know all modern terminal emulators let the user define 16
colors, even if the terminal emulator supports true color (256 colors).

And as for Vim handling manually configured colors, note 'ctermfg=1' is
red .  If I change the value of 'Red' in Suckless Terminal config to a
hex value of something green, 'ctermfg=1' shows green.  I mean, this is
the expected behavior, right?  Vim gives the terminal emulator a color
code; the terminal emulator decides how to render that, according to its
config.

> > The fun part is: I ssh'd into my Linux laptop from my Windows
> > laptop.
>
> What do you set $TERM to then?  I doubt a Linux system has any
> specific terminfo/termcap entry for that.  I don't even know what ssh
> command would be able to make a connection from a Windows Terminal.
> I've used Putty (with varying success) and the Secure Shell built
> into Chrome, which works quite well.

I ssh'd with MSYS's ssh binary.  The $TERM value is undefined in Windows
Terminal.  ':set term?' in Vim-in-Linux-over-SSH-on-Windows shows
'xterm-256colors'.  Don't know where that's being defined.

> > 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.)
>
> The 'builtin_win32" entry predates Windows Terminal by many years, it
> was made for the Windows console, and not for use with ssh.  I don't
> know what best to use for Windows Terminal, it has been under
> development for quite a long time.  Not sure if it can be considered
> "stable" now.  And I have no idea what to expect from an ssh command
> running in Windows Terminal.  What would it set $TERM to?  What ssh
> command is even available for this?

I think I covered this above.  And anyway, I was not intending to dive
into terminal stuff.  I thought 'ctermfg=7' was a case specially handled
in Vim source, basically something like this:

    if (do_ctermfg && arg == 7) {
      arg = 0;  // forcefully use black color
    }

This ^ is what I was expecting.  If true, I was gonna comment it out.
Seems like this isn't the case.  No problem.  Thanks.


--
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20230505140319.70ae0328%40cirdan.

Raspunde prin e-mail lui