Wednesday, January 26, 2011

Dynamically adding custom colour to rgb.txt

I have a custom defined colour "0 96 255 Bob_Blue" that I
want to use in more than one place in Windows gvim 7.3. I
can do this by adding it to $VIMRUNTIME\rgb.txt but that
will be lost when I upgrade. Defining colours in other
places has been discussed comprehensively before e.g. in
2005 [1], the upshot as I understand it is that you have to
define the name in rgb.txt, the file cannot be in another
location, but changes to it are instantly available without
restarting vim. As far as I can tell from the help and other
searches this is still how it works.

I'm therefore thinking of having a few lines at the start of
_vimrc that will search rgb.txt for my custom colour and add
it if not present. I'm wondering if there's an obvious
problem with doing that, or maybe I'm overlooking a better
way to define a new colour - I can't find one?

Some other ways I've considered and rejected:
. Always use #0060FF instead of the name
. Redefine one of my Windows system colours and use that
. Define it as a highlight group instead of a colour per se

regards,
Geoff

[1] http://vim.1045645.n5.nabble.com/How-to-solve-E254-Cannot-allocate-color-darkyellow-td1139869i20.html

--
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

No comments: