Wednesday, April 16, 2025

Re: Custom highlight color outside the 16-set cterm palette?

On 16.04.25 08:01, Steven H. wrote:
> I would like to use '#222222' instead of 'black' for background
> *without* that affecting any other color in the color scheme.
>
> How can I do that?

For nearly 40 years now, I've used the multitudinous *term colours,
which remain in effect in vi/vim, mutt, etc. In that time, I've stuck
with:

   -fg yellow -bg darkslategrey -cr red

as it's very restful on the eyes, and a simple way to set the
background colour.

There's 754 colours in my /etc/X11/rgb.txt, but 782 in
/usr/share/vim/vim81/rgb.txt , maybe more in a more current version. And I guess you could add your own, if needed.

But I change the cursor colour in vim, using its limited palette, to
differentiate insert vs normal mode at the cursor, not just the status
line.

"MODE-INDICATING TRICOLOUR CURSOR:
"Appearance: (Insert_Mode = Red, Replace Mode = Purple, Normal_Mode = Green)
if &term =~ "xterm"
   let &t_SI = "\<Esc>]12;red\x7"
   let &t_SR = "\<Esc>]12;purple\x7"
   let &t_EI = "\<Esc>]12;green\x7"
endif

Admittedly, it's not tested with every terminal variant out there. Now that xterms support utf8, I've no need for odd ones.

Erik

--
--
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+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/vim_use/ef82a670-9b8f-475c-bc54-f17b3eba5d9b%40localhost.

No comments: