用怎样的CSI可以输出带暗色背景的字,比如那个调色盘中的灰色或灰蓝色?
也就是怎样加亮背景色?(加亮前景色可以用“1”,加亮背景色用什么?)
难道一定要用 256 色终端?
最近编辑记录 cjxgm (2013-07-16 19:49:54)
Giumo Clanjor (哆啦比猫/兰威举)
Where there is a hacker, there is art. | Dogfooding myself. (C++ / Lua / Perl / Rust)
离线
试试这个?
#!/usr/bin/perl
# Author: Todd Larason <jtl@molehill.org>
# $XFree86: xc/programs/xterm/vttests/256colors2.pl,v 1.1 1999/07/11 08:49:54 dawes Exp $
# use the resources for colors 0-15 - usually more-or-less a
# reproduction of the standard ANSI colors, but possibly more
# pleasing shades
# colors 16-231 are a 6x6x6 color cube
for ($red = 0; $red < 6; $red++) {
for ($green = 0; $green < 6; $green++) {
for ($blue = 0; $blue < 6; $blue++) {
printf("\x1b]4;%d;rgb:%2.2x/%2.2x/%2.2x\x1b\\",
16 + ($red * 36) + ($green * 6) + $blue,
int ($red * 42.5),
int ($green * 42.5),
int ($blue * 42.5));
}
}
}
# colors 232-255 are a grayscale ramp, intentionally leaving out
# black and white
for ($gray = 0; $gray < 24; $gray++) {
$level = ($gray * 10) + 8;
printf("\x1b]4;%d;rgb:%2.2x/%2.2x/%2.2x\x1b\\",
232 + $gray, $level, $level, $level);
}
# display the colors
# first the system ones:
print "System colors:\n";
for ($color = 0; $color < 8; $color++) {
print "\x1b[48;5;${color}m ";
}
print "\x1b[0m\n";
for ($color = 8; $color < 16; $color++) {
print "\x1b[48;5;${color}m ";
}
print "\x1b[0m\n\n";
# now the color cube
print "Color cube, 6x6x6:\n";
for ($green = 0; $green < 6; $green++) {
for ($red = 0; $red < 6; $red++) {
for ($blue = 0; $blue < 6; $blue++) {
$color = 16 + ($red * 36) + ($green * 6) + $blue;
print "\x1b[48;5;${color}m ";
}
print "\x1b[0m ";
}
print "\n";
}
# now the grayscale ramp
print "Grayscale ramp:\n";
for ($color = 232; $color < 256; $color++) {
print "\x1b[48;5;${color}m ";
}
print "\x1b[0m\n";
离线
试试这个?
Thanks,找到了,是“48;5;8”:
\e[48;5;8;30m # 灰底黑字
wikipedia上说是 xterm 256色 color index?
不知道有没有兼容性问题
BTW,原生终端里的 vim 怎么用这个颜色(48;5;8;30)?
hi Folded ctermbg=darkgray ctermfg=black
得到的是黑底黑字……
BTW2,vim 里 fold 前面的行号可否指定不同的颜色?
最近编辑记录 cjxgm (2013-07-13 19:56:20)
Giumo Clanjor (哆啦比猫/兰威举)
Where there is a hacker, there is art. | Dogfooding myself. (C++ / Lua / Perl / Rust)
离线
BTW,原生终端里的 vim 怎么用这个颜色(48;5;8;30)?
hi Folded ctermbg=darkgray ctermfg=black
得到的是黑底黑字……
BTW2,vim 里 fold 前面的行号可否指定不同的颜色?
1. cterm* 好像只能用数学指定吧?
2. 仅被折叠的那一行?
离线
1. cterm* 好像只能用数学指定吧?
对啊,然后就不知道怎么搞了
2. 仅被折叠的那一行?
是的,至少,让被折叠的那一行的行号颜色和普通的行号颜色一样吧
Giumo Clanjor (哆啦比猫/兰威举)
Where there is a hacker, there is art. | Dogfooding myself. (C++ / Lua / Perl / Rust)
离线
是的,至少,让被折叠的那一行的行号颜色和普通的行号颜色一样吧
https://f92fac806bf10a96c0b8-8a0a46e5f1 … 1/snap.png
这样啊……要不你用 hi link Folded LineNr 吧?
离线
百合仙子 说:1. cterm* 好像只能用数学指定吧?
对啊,然后就不知道怎么搞了
就14个颜色,自己映射啦。
离线
cjxgm 说:百合仙子 说:1. cterm* 好像只能用数学指定吧?
对啊,然后就不知道怎么搞了
就14个颜色,自己映射啦。
发现了,原来可以这样
syntax enable
" press <C-v><ESC> to input a real <Esc> below.
set t_AB=<Esc>[48;5;%dm
set t_AF=<Esc>[38;5;%dm
hi Folded ctermbg=8 ctermfg=0
不过 TTY 里无效
最近编辑记录 cjxgm (2013-07-14 14:07:13)
Giumo Clanjor (哆啦比猫/兰威举)
Where there is a hacker, there is art. | Dogfooding myself. (C++ / Lua / Perl / Rust)
离线
cjxgm 说:是的,至少,让被折叠的那一行的行号颜色和普通的行号颜色一样吧
https://f92fac806bf10a96c0b8-8a0a46e5f1 … 1/snap.png这样啊……要不你用 hi link Folded LineNr 吧?
加到 vimrc 里,没什么变化……
不过 hi link Folded LineNr 不是应该让被折叠的那一整行和行号颜色一样么?
我只想要行号部分统一
Giumo Clanjor (哆啦比猫/兰威举)
Where there is a hacker, there is art. | Dogfooding myself. (C++ / Lua / Perl / Rust)
离线
百合仙子 说:cjxgm 说:是的,至少,让被折叠的那一行的行号颜色和普通的行号颜色一样吧
https://f92fac806bf10a96c0b8-8a0a46e5f1 … 1/snap.png这样啊……要不你用 hi link Folded LineNr 吧?
加到 vimrc 里,没什么变化……
不过 hi link Folded LineNr 不是应该让被折叠的那一整行和行号颜色一样么?
我只想要行号部分统一
目前貌似还不行呢,你去做个补丁?
离线
你去做个补丁?
vim源代码好那啥,一个文件一万行呢……
不过还是搞定了:
hi FoldedLineNumber ctermbg=12 ctermfg=3
diff -r aed1105b7cfd -r b10c844e3e4b src/option.c
--- a/src/option.c Sun Jul 14 13:41:56 2013 +0200
+++ b/src/option.c Sun Jul 14 23:09:12 2013 +0800
@@ -462,7 +462,7 @@
#if defined(FEAT_DIFF) || defined(FEAT_FOLDING) || defined(FEAT_SPELL) \
|| defined(FEAT_VERTSPLIT) || defined(FEAT_CLIPBOARD) \
|| defined(FEAT_INS_EXPAND) || defined(FEAT_SYN_HL) || defined(FEAT_CONCEAL)
-# define HIGHLIGHT_INIT "8:SpecialKey,@:NonText,d:Directory,e:ErrorMsg,i:IncSearch,l:Search,m:MoreMsg,M:ModeMsg,n:LineNr,N:CursorLineNr,r:Question,s:StatusLine,S:StatusLineNC,c:VertSplit,t:Title,v:Visual,V:VisualNOS,w:WarningMsg,W:WildMenu,f:Folded,F:FoldColumn,A:DiffAdd,C:DiffChange,D:DiffDelete,T:DiffText,>:SignColumn,-:Conceal,B:SpellBad,P:SpellCap,R:SpellRare,L:SpellLocal,+:Pmenu,=:PmenuSel,x:PmenuSbar,X:PmenuThumb,*:TabLine,#:TabLineSel,_:TabLineFill,!:CursorColumn,.:CursorLine,o:ColorColumn"
+# define HIGHLIGHT_INIT "8:SpecialKey,@:NonText,d:Directory,e:ErrorMsg,i:IncSearch,l:Search,m:MoreMsg,M:ModeMsg,n:LineNr,N:CursorLineNr,r:Question,s:StatusLine,S:StatusLineNC,c:VertSplit,t:Title,v:Visual,V:VisualNOS,w:WarningMsg,W:WildMenu,f:Folded,F:FoldedLineNumber,G:FoldColumn,A:DiffAdd,C:DiffChange,D:DiffDelete,T:DiffText,>:SignColumn,-:Conceal,B:SpellBad,P:SpellCap,R:SpellRare,L:SpellLocal,+:Pmenu,=:PmenuSel,x:PmenuSbar,X:PmenuThumb,*:TabLine,#:TabLineSel,_:TabLineFill,!:CursorColumn,.:CursorLine,o:ColorColumn"
#else
# define HIGHLIGHT_INIT "8:SpecialKey,@:NonText,d:Directory,e:ErrorMsg,i:IncSearch,l:Search,m:MoreMsg,M:ModeMsg,n:LineNr,N:CursorLineNr,r:Question,s:StatusLine,S:StatusLineNC,t:Title,v:Visual,w:WarningMsg,W:WildMenu,>:SignColumn,*:TabLine,#:TabLineSel,_:TabLineFill"
#endif
diff -r aed1105b7cfd -r b10c844e3e4b src/screen.c
--- a/src/screen.c Sun Jul 14 13:41:56 2013 +0200
+++ b/src/screen.c Sun Jul 14 23:09:12 2013 +0800
@@ -2449,10 +2449,10 @@
if (wp->w_p_rl)
/* the line number isn't reversed */
copy_text_attr(off + W_WIDTH(wp) - len - col,
- (char_u *)" ", len, hl_attr(HLF_FL));
+ (char_u *)" ", len, hl_attr(HLF_FLN));
else
# endif
- copy_text_attr(off + col, (char_u *)" ", len, hl_attr(HLF_FL));
+ copy_text_attr(off + col, (char_u *)" ", len, hl_attr(HLF_FLN));
col += len;
}
}
@@ -2494,10 +2494,10 @@
if (wp->w_p_rl)
/* the line number isn't reversed */
copy_text_attr(off + W_WIDTH(wp) - len - col, buf, len,
- hl_attr(HLF_FL));
+ hl_attr(HLF_FLN));
else
#endif
- copy_text_attr(off + col, buf, len, hl_attr(HLF_FL));
+ copy_text_attr(off + col, buf, len, hl_attr(HLF_FLN));
col += len;
}
}
diff -r aed1105b7cfd -r b10c844e3e4b src/vim.h
--- a/src/vim.h Sun Jul 14 13:41:56 2013 +0200
+++ b/src/vim.h Sun Jul 14 23:09:12 2013 +0800
@@ -1341,6 +1341,7 @@
, HLF_W /* warning messages */
, HLF_WM /* Wildmenu highlight */
, HLF_FL /* Folded line */
+ , HLF_FLN /* Folded line number */
, HLF_FC /* Fold column */
, HLF_ADD /* Added diff line */
, HLF_CHD /* Changed diff line */
@@ -1369,7 +1370,7 @@
* When changing this also adjust the default for 'highlight'. */
#define HL_FLAGS {'8', '@', 'd', 'e', 'h', 'i', 'l', 'm', 'M', \
'n', 'N', 'r', 's', 'S', 'c', 't', 'v', 'V', 'w', 'W', \
- 'f', 'F', 'A', 'C', 'D', 'T', '-', '>', \
+ 'f', 'F', 'G', 'A', 'C', 'D', 'T', '-', '>', \
'B', 'P', 'R', 'L', \
'+', '=', 'x', 'X', '*', '#', '_', '!', '.', 'o'}
不知道怎么交,先放这儿吧(vim74 hg repo r5195)
最近编辑记录 cjxgm (2013-07-14 22:58:43)
Giumo Clanjor (哆啦比猫/兰威举)
Where there is a hacker, there is art. | Dogfooding myself. (C++ / Lua / Perl / Rust)
离线
不知道怎么交,先放这儿吧(vim74 hg repo r5195)
好厉害哦~
你可以把补丁邮给 Bram 和/或 vim_dev 列表。
离线
百合仙子 说:1. cterm* 好像只能用数学指定吧?
对啊,然后就不知道怎么搞了
百合仙子 说:2. 仅被折叠的那一行?
是的,至少,让被折叠的那一行的行号颜色和普通的行号颜色一样吧
https://f92fac806bf10a96c0b8-8a0a46e5f1 … 1/snap.png
被折叠的行颜色暗,这样更醒目吧?
马甲与本尊同在
离线
被折叠的行颜色暗,这样更醒目吧?
太亮的话注意力都被折叠行吸引去了
最近编辑记录 cjxgm (2013-07-15 10:27:15)
Giumo Clanjor (哆啦比猫/兰威举)
Where there is a hacker, there is art. | Dogfooding myself. (C++ / Lua / Perl / Rust)
离线
被折叠的行颜色暗,这样更醒目吧?
嗯,如果这个补丁被包含的话,我肯定把我的配色中折叠行调暗一点。
离线