A question about highlight-cterm

12 views
Skip to first unread message

Lifepillar

unread,
May 11, 2019, 6:04:46 AM5/11/19
to 'Lifepillar' via vim_use
I am a bit puzzled by the note in `:help highlight-cterm`:

Note: Many terminals (e.g., DOS console) can't mix these attributes with
coloring. Use only one of "cterm=" OR "ctermfg=" OR "ctermbg=“.

Virtually all colorschemes I have seen use ctermfg AND ctermbg AND cterm.

The note above is also at odds with `:help cterm-colors`, which states:

If you want to set the bold attribute in a different way, put a "cterm="
argument AFTER the "ctermfg=" or "ctermbg=" argument.

Which implies that cterm and ctermfg/ctermbg can coexist.

Perhaps, the above note is a thing of the past and should be removed?

Thanks,
Life.


Tony Mechelynck

unread,
May 11, 2019, 6:27:33 AM5/11/19
to vim...@googlegroups.com
I believe that the confusion is due to the fact that (a) cterm=NONE;
(b) cterm=bold; (c) other values interact in three different ways
(when they do at all) with bg/fg color settings.

IIUC you can use cterm=NONE _before_ ctermbg= ctermfg= in order to
clear anything that may be present before (such as bold) but not your
own colours. It *may* be possible to add cterm=bold after a ctermfg=
color in the range 0..7; OTOH ctermfg= in the range 8..16 (on an
8-or-16-bg 16-fg terminal) usually _implies_ bold. Using both
cterm=underline and ctermfg= ctermbg= will usually not work as
expected. OTOH AFAIK ctermbg= and ctermfg= can usually be used
together provided that you don't exceed the terminal's capabilities.

Best regards,
Tony.

Bram Moolenaar

unread,
May 11, 2019, 7:10:14 AM5/11/19
to vim...@googlegroups.com
It is not of the past, the basic ANSI terminal still only has 8 or 16
colors. But most users would be using 256 colors whenever they can.
Let's rephrase this:

Note: Some terminals (e.g., DOS console) can't mix these attributes
with coloring. To be portable, use only one of "cterm=" OR "ctermfg="
OR "ctermbg=".

--
This message contains 78% recycled characters.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Lifepillar

unread,
May 11, 2019, 3:56:06 PM5/11/19
to 'Lifepillar' via vim_use
On 11 May 2019, at 13:10, Bram Moolenaar <Br...@moolenaar.net> wrote:


I am a bit puzzled by the note in `:help highlight-cterm`:

   Note: Many terminals (e.g., DOS console) can't mix these attributes with
   coloring. Use only one of "cterm=" OR "ctermfg=" OR "ctermbg=“.

Virtually all colorschemes I have seen use ctermfg AND ctermbg AND cterm.

The note above is also at odds with `:help cterm-colors`, which states:

   If you want to set the bold attribute in a different way, put a "cterm="
   argument AFTER the "ctermfg=" or "ctermbg=" argument.

Which implies that cterm and ctermfg/ctermbg can coexist.

Perhaps, the above note is a thing of the past and should be removed?

It is not of the past, the basic ANSI terminal still only has 8 or 16
colors.

I have never encountered an issue using ctermfg and ctermbg (and cterm) in the
same definition, even with as few as eight colors, provided that the values are
in the 0-7 range. Perhaps it is because I am mostly working with xterm, or
I haven't looked hard enough. I am curious which terminals one might use in
Unix/Linux/macOS land to experiment with terminal emulators' weirdness.

Looking at the colorschemes distributed with Vim, it seems that the "xor rule"
of highlight-cterm is not honored. I guess that they are portable enough
nonetheless.

Anyway, thank you both for the feedback!
Life.

Reply all
Reply to author
Forward
0 new messages