From 43fa75f427dd941c01df0e5ad0bd4881a4bfd15d Mon Sep 17 00:00:00 2001 From: Ludovic Koenig Date: Wed, 6 Mar 2019 20:02:47 +0100 Subject: [PATCH] Separate the Utility in two The are now two Utility sections: - Color Utility: Part of the script that helps defining colors. - Highlight Utility: Part of the script that helps defining highlights. --- colors/odyssey.vim | 47 ++++++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/colors/odyssey.vim b/colors/odyssey.vim index 062d89f..4968eef 100644 --- a/colors/odyssey.vim +++ b/colors/odyssey.vim @@ -35,10 +35,10 @@ endif let g:colors_name = 'odyssey' -let s:colors = {} - " }}} -" Utilities {{{ +" Color Utilities {{{ + +let s:colors = {} function! s:hsv2hex(hue, saturation, value) let l:s = a:saturation / 100.0 @@ -73,25 +73,6 @@ function! s:hsv2hex(hue, saturation, value) return printf(l:f, l:l[0]) . printf(l:f, l:l[1]) . printf(l:f, l:l[2]) endfunction -function! s:HL(group, bg, ...) - let histring = 'highlight ' . a:group . ' ' - let cbg = get(s:colors, a:bg) - let histring .= 'guibg=#'. cbg['gui'] . ' ' . 'ctermbg=' . cbg['term'] - - if a:0 > 0 - let cfg = get(s:colors, a:1) - let histring .= ' guifg=#'. cfg['gui'] . ' ' . 'ctermfg=' . cfg['term'] - endif - - if a:0 > 1 - let histring .= ' cterm=' . a:2 - else - let histring .= ' cterm=none' - endif - - execute histring -endfunction - " }}} " Colors {{{ " @@ -116,6 +97,28 @@ let s:colors.procedure = {'gui': s:hsv2hex(140, 45, 70), 'term': '72'} let s:colors.type = {'gui': s:hsv2hex(200, 45, 70), 'term': '67'} let s:colors.constant = {'gui': s:hsv2hex(230, 45, 70), 'term': '61'} +" }}} +" Highlight Utilities {{{ + +function! s:HL(group, bg, ...) + let histring = 'highlight ' . a:group . ' ' + let cbg = get(s:colors, a:bg) + let histring .= 'guibg=#'. cbg['gui'] . ' ' . 'ctermbg=' . cbg['term'] + + if a:0 > 0 + let cfg = get(s:colors, a:1) + let histring .= ' guifg=#'. cfg['gui'] . ' ' . 'ctermfg=' . cfg['term'] + endif + + if a:0 > 1 + let histring .= ' cterm=' . a:2 + else + let histring .= ' cterm=none' + endif + + execute histring +endfunction + " }}} " Default Highlights {{{ "