From 468baebd45e09f1b3a9ff344904b8839a9bc17c8 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Wed, 2 Jul 2014 17:45:58 +0900 Subject: [PATCH] Update ANSI code interpolation to cover more cases --- plugin/limelight.vim | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/plugin/limelight.vim b/plugin/limelight.vim index 5ebe2ea..b531123 100644 --- a/plugin/limelight.vim +++ b/plugin/limelight.vim @@ -72,8 +72,16 @@ function! s:hex2rgb(str) return [eval('0x'.str[0:1]), eval('0x'.str[2:3]), eval('0x'.str[4:5])] endfunction +let s:gray_converter = { +\ 0: 231, +\ 7: 254, +\ 15: 256, +\ 16: 231, +\ 231: 256 +\ } + function! s:gray_contiguous(col) - let val = (a:col == 15 || a:col == 231) ? 256 : (a:col == 0 ? 231 : a:col) + let val = get(s:gray_converter, a:col, a:col) if val < 231 || val > 256 throw s:unsupported endif