what is the difference between cterm color and gui color?
Asked Answered
M

2

18

I am customizing my own color scheme for Vim but I don't know when should I configure ctermfg/ctermbg variable and guifg/guibg variable because I didn't see any differences between them at all. Is there any difference between them?

Can any one give me an illustrative example of how to use them ? Thanks

Mobcap answered 8/3, 2020 at 17:50 Comment(0)
L
25

I didn't see any differences between them at all

ctermxx is used by console version of Vim (when set notermguicolors). guixx is used in GVim, or in console if set termguicolors, and the console is capable of TrueColor, obviously. Hence you must test it in different programs to see the difference.

Also, some colors could be the same or very close to each other, e.g. "blue" is "blue" both in GUI and console.

Can any one give me an illustrative example of how to use them?

hi Normal guifg=#1034a6 guibg=#f5f5dc ctermfg=19 ctermbg=230

Should look very similar but still a little different in GUI and console

For symbolic colors names see :h cterm-colors and $VIMRUNTIME/rgb.txt. The cheat sheet of 256 color indexes for console is available here.

Lavonda answered 8/3, 2020 at 18:34 Comment(0)
R
2

The separate pairs allow you to specify different colors for a terminal (which may limit you to a fixed-sized palette of colors, usually 16 or 256) and a GUI (which typically provides a much larger palette or even direct access to any color your display can handle).

For example, if you start a session in your terminal using vi some_file.txt, then ctermfg and ctermbg would be used. If you start an instance of gvim (which opens its own window independent of your terminal emulator), then guifg and guibg are used instead.

Rugged answered 8/3, 2020 at 17:52 Comment(1)
If there is a line like this what does it mean: hi StatusLine guifg=blue guibg=darkgray gui=none ctermfg=blue ctermbg=gray term=none cterm=noneFrick

© 2022 - 2024 — McMap. All rights reserved.