On 15/07/10 00:34, Benjamin R. Haskell wrote:
On Wed, 14 Jul 2010, Tony Mechelynck wrote:
On 14/07/10 22:57, Bram Moolenaar wrote:
Matt Wozniski wrote:
[about a patch to support #rrggbb in a terminal]
Where can I find the latest version of this patch? I only see one
that is two years old.
Is such a patch necessary? The CSApprox plugin gives me uniform look&
feel between GUI and xterm-256color; OTOH I can still use _different_
cterm ctermbg ctermfg colors for the Linux console which has only
(IIUC) 8 colors + foreground bold.
With this plugin installed I can think (and program my colorshceme) in
terms of: term= black& white only, possibly bold and/or underline;
cterm= 8 to 16 colors; gui= 88 to 16777216 colors — CSApprox does the
"dirty work" of converting "gui" rrggbb values to palette ordinal
numbers when in 88- or 256-color consoles.
In the off-chance you hadn't noticed, Matt Wozniski is the author of
both the patch in question and the CSApprox plugin.
I'm not sure how either the patch or the plugin works currently, but
personally, I'd prefer that #rrggbb conversion for terminals gets
integrated into the main program.
[...]
I agree that getting it working so that colorschemes can be written
toward the following guidelines would be most convenient:
term= no 'colors'
cterm= 8 or 16 colors
gui= 88 / 256 / 'true' colors
But as I said, I'd rather it not require a plugin.
Well, at least we agree on one point: we'd prefer guifg=#123456 to work
in 88+ color terminal, rather than ctermfg=#123456 which would prevent
writing "ctermfg=cyan guifg=#123456" to cover low-color terminals too.
OTOH, I believe that CSApprox does the job well, with no appreciable
delay, and I don't feel the necessity of patching the C code. It even
has accessible "hooks" for special cases (see below). What _would_ be
useful would be to distribute that plugin as part of the vanilla Vim
distribution, maybe "disabled matchit-like" if people don't want Vim in
xterm-256 and gvim to look alike.
Example of a special case: (my vimrc sets CSApprox_loaded to 1 on the
Linux console and) my colorscheme includes the following:
" display the status line of the active window in a distinctive color:
" bold black on bright red in the GUI, white on green in the console
" (where the bg is never bright, and dark red is sometimes an ugly sort
" of reddish brown).
hi StatusLine gui=NONE,bold guibg=red guifg=black
\ cterm=NONE,bold ctermbg=darkgreen ctermfg=white
hi WildMenu gui=NONE,bold guibg=green guifg=black
\ cterm=NONE,bold ctermbg=black ctermfg=white
" make the status line bold-reverse (but B&W) for inactive windows
hi StatusLineNC gui=reverse,bold
\ cterm=NONE ctermbg=black ctermfg=lightgrey
" make the active status line colours alternate between two settings
" to give a visual notice of the CursorHold/CursorHoldI events
if ! exists("s:statuslineflag")
let s:statuslineflag = 0
endif
"
" The following 'fancy footwork' is needed to have our CursorHold autocommand
" work smoothly with 256-color cterms handled by the 3rd-party csapprox.vim
plugin
if exists('g:CSApprox_approximator_function')
let s:ctbg1 = g:CSApprox_approximator_function(0, 255, 0) " green
let s:ctbg2 = g:CSApprox_approximator_function(255, 0, 0) " red
let s:ctfg = g:CSApprox_approximator_function(0, 0, 0) " black
else
let s:ctbg1 = 'darkgreen'
let s:ctbg2 = 'black'
let s:ctfg = 'white'
endif
function! ToggleStatusLine()
if s:statuslineflag
exe 'hi StatusLine'
\ 'cterm=NONE,bold ctermbg=' . s:ctbg1 'ctermfg=' . s:ctfg
\ 'gui=NONE,bold guibg=green guifg=black'
exe 'hi WildMenu'
\ 'cterm=NONE,bold ctermbg=' . s:ctbg2 'ctermfg=' . s:ctfg
\ 'gui=NONE,bold guibg=red guifg=black'
else
exe 'hi StatusLine'
\ 'cterm=NONE,bold ctermbg=' . s:ctbg2 'ctermfg=' . s:ctfg
\ 'gui=NONE,bold guibg=red guifg=black'
exe 'hi WildMenu'
\ 'cterm=NONE,bold ctermbg=' . s:ctbg1 'ctermfg=' . s:ctfg
\ 'gui=NONE,bold guibg=green guifg=black'
endif
let s:statuslineflag = ! s:statuslineflag
endfunction
exe "augroup" s:colors_name
au! CursorHold,CursorHoldI * call ToggleStatusLine()
au! ColorScheme *
\ if g:colors_name != s:colors_name | exe "au!" s:colors_name | endif
augroup END
Best regards,
Tony.
--
Democracy, n.:
A government of the masses. Authority derived through mass
meeting or any other form of direct expression. Results in mobocracy.
Attitude toward property is communistic... negating property rights.
Attitude toward law is that the will of the majority shall regulate,
whether it is based upon deliberation or governed by passion,
prejudice, and impulse, without restraint or regard to consequences.
Result is demagogism, license, agitation, discontent, anarchy.
-- U. S. Army Training Manual No. 2000-25 (1928-1932),
since withdrawn.
--
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