From 6b705b490d6966b370c395bb137663a725c7f6ea Mon Sep 17 00:00:00 2001 From: Bailey Ling Date: Tue, 9 Jul 2013 01:22:04 +0000 Subject: [PATCH] refactor colors to use color map generator --- autoload/airline/themes.vim | 11 +++++++++++ autoload/airline/themes/badwolf.vim | 27 +++++---------------------- autoload/airline/themes/dark.vim | 27 +++++---------------------- autoload/airline/themes/light.vim | 27 +++++---------------------- autoload/airline/themes/solarized.vim | 27 +++++---------------------- 5 files changed, 31 insertions(+), 88 deletions(-) create mode 100644 autoload/airline/themes.vim diff --git a/autoload/airline/themes.vim b/autoload/airline/themes.vim new file mode 100644 index 0000000..3c12515 --- /dev/null +++ b/autoload/airline/themes.vim @@ -0,0 +1,11 @@ +" generates a hashtable which defines the colors for each highlight group +function! airline#themes#generate_color_map(section1, section2, section3) + " guifg guibg ctermfg ctermbg gui/term + return { + \ 'mode': [ a:section1[0] , a:section1[1] , a:section1[2] , a:section1[3] , 'bold' ] , + \ 'mode_separator': [ a:section1[1] , a:section2[1] , a:section1[3] , a:section2[3] , 'bold' ] , + \ 'info': [ a:section2[0] , a:section2[1] , a:section2[2] , a:section2[3] , '' ] , + \ 'info_separator': [ a:section2[1] , a:section3[1] , a:section2[3] , a:section3[3] , 'bold' ] , + \ 'statusline': [ a:section3[0] , a:section3[1] , a:section3[2] , a:section3[3] , '' ] , + \ } +endfunction diff --git a/autoload/airline/themes/badwolf.vim b/autoload/airline/themes/badwolf.vim index 9c0c588..fd7cf4e 100644 --- a/autoload/airline/themes/badwolf.vim +++ b/autoload/airline/themes/badwolf.vim @@ -3,14 +3,9 @@ let g:airline#themes#badwolf#inactive = { 'mode': [ '#45413b' , '#242321' , 238 let s:N1 = [ '#141413' , '#aeee00' , 232 , 154 ] let s:N2 = [ '#f4cf86' , '#45413b' , 222 , 238 ] let s:N3 = [ '#8cffba' , '#242321' , 121 , 235 ] -let g:airline#themes#badwolf#normal = { - \ 'mode': [ s:N1[0] , s:N1[1] , s:N1[2] , s:N1[3] , 'bold' ] , - \ 'mode_separator': [ s:N1[1] , s:N2[1] , s:N1[3] , s:N2[3] , 'bold' ] , - \ 'info': [ s:N2[0] , s:N2[1] , s:N2[2] , s:N2[3] , '' ] , - \ 'info_separator': [ s:N2[1] , s:N3[1] , s:N2[3] , s:N3[3] , 'bold' ] , - \ 'statusline': [ s:N3[0] , s:N3[1] , s:N3[2] , s:N3[3] , '' ] , - \ 'file': [ '#ff2c4b' , '#242321' , 196 , 235 , '' ] , - \ } +let g:airline#themes#badwolf#normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) +let g:airline#themes#badwolf#normal.file = [ '#ff2c4b' , '#242321' , 196 , 235 , '' ] + let g:airline#themes#badwolf#normal_modified = { \ 'mode_separator' : [ '#aeee00' , '#666462' , 154 , 241 , 'bold' ] , \ 'info' : [ '#f4cf86' , '#666462' , 222 , 241 , '' ] , @@ -21,13 +16,7 @@ let g:airline#themes#badwolf#normal_modified = { let s:I1 = [ '#141413' , '#0a9dff' , 232 , 39 ] let s:I2 = [ '#f4cf86' , '#005fff' , 222 , 27 ] let s:I3 = [ '#0a9dff' , '#242321' , 39 , 235 ] -let g:airline#themes#badwolf#insert = { - \ 'mode': [ s:I1[0] , s:I1[1] , s:I1[2] , s:I1[3] , 'bold' ] , - \ 'mode_separator': [ s:I1[1] , s:I2[1] , s:I1[3] , s:I2[3] , 'bold' ] , - \ 'info': [ s:I2[0] , s:I2[1] , s:I2[2] , s:I2[3] , '' ] , - \ 'info_separator': [ s:I2[1] , s:I3[1] , s:I2[3] , s:I3[3] , 'bold' ] , - \ 'statusline': [ s:I3[0] , s:I3[1] , s:I3[2] , s:I3[3] , '' ] , - \ } +let g:airline#themes#badwolf#insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3) let g:airline#themes#badwolf#insert_modified = { \ 'info_separator' : [ '#005fff' , '#45413b' , 27 , 238 , 'bold' ] , \ 'statusline' : [ '#ffa724' , '#45413b' , 214 , 238 , '' ] , @@ -44,13 +33,7 @@ let g:airline#themes#badwolf#insert_replace = { let s:V1 = [ '#141413' , '#ffa724' , 232 , 214 ] let s:V2 = [ '#000000' , '#fade3e' , 16 , 221 ] let s:V3 = [ '#000000' , '#b88853' , 16 , 137 ] -let g:airline#themes#badwolf#visual = { - \ 'mode': [ s:V1[0] , s:V1[1] , s:V1[2] , s:V1[3] , 'bold' ] , - \ 'mode_separator': [ s:V1[1] , s:V2[1] , s:V1[3] , s:V2[3] , 'bold' ] , - \ 'info': [ s:V2[0] , s:V2[1] , s:V2[2] , s:V2[3] , '' ] , - \ 'info_separator': [ s:V2[1] , s:V3[1] , s:V2[3] , s:V3[3] , 'bold' ] , - \ 'statusline': [ s:V3[0] , s:V3[1] , s:V3[2] , s:V3[3] , '' ] , - \ } +let g:airline#themes#badwolf#visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3) let g:airline#themes#badwolf#visual_modified = { \ 'info_separator' : [ '#fade3e' , '#c7915b' , 221 , 173 , 'bold' ] , \ 'statusline' : [ '#000000' , '#c7915b' , 16 , 173 , '' ] , diff --git a/autoload/airline/themes/dark.vim b/autoload/airline/themes/dark.vim index 542f444..08de1f4 100644 --- a/autoload/airline/themes/dark.vim +++ b/autoload/airline/themes/dark.vim @@ -3,14 +3,9 @@ let g:airline#themes#dark#inactive = { 'mode': [ '#4e4e4e' , '#1c1c1c' , 239 , 2 let s:N1 = [ '#00005f' , '#dfff00' , 17 , 190 ] let s:N2 = [ '#ffffff' , '#444444' , 255 , 238 ] let s:N3 = [ '#9cffd3' , '#202020' , 85 , 234 ] -let g:airline#themes#dark#normal = { - \ 'mode': [ s:N1[0] , s:N1[1] , s:N1[2] , s:N1[3] , 'bold' ] , - \ 'mode_separator': [ s:N1[1] , s:N2[1] , s:N1[3] , s:N2[3] , 'bold' ] , - \ 'info': [ s:N2[0] , s:N2[1] , s:N2[2] , s:N2[3] , '' ] , - \ 'info_separator': [ s:N2[1] , s:N3[1] , s:N2[3] , s:N3[3] , 'bold' ] , - \ 'statusline': [ s:N3[0] , s:N3[1] , s:N3[2] , s:N3[3] , '' ] , - \ 'file': [ '#ff0000' , '#1c1c1c' , 160 , 233 , '' ] , - \ } +let g:airline#themes#dark#normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) +let g:airline#themes#dark#normal.file = [ '#ff0000' , '#1c1c1c' , 160 , 233 , '' ] + let g:airline#themes#dark#normal_modified = { \ 'info_separator': [ '#444444' , '#5f005f' , 238 , 53 , '' ] , \ 'statusline': [ '#ffffff' , '#5f005f' , 255 , 53 , '' ] , @@ -19,13 +14,7 @@ let g:airline#themes#dark#normal_modified = { let s:I1 = [ '#00005f' , '#00dfff' , 17 , 45 ] let s:I2 = [ '#ffffff' , '#005fff' , 255 , 27 ] let s:I3 = [ '#ffffff' , '#000080' , 15 , 17 ] -let g:airline#themes#dark#insert = { - \ 'mode': [ s:I1[0] , s:I1[1] , s:I1[2] , s:I1[3] , 'bold' ] , - \ 'mode_separator': [ s:I1[1] , s:I2[1] , s:I1[3] , s:I2[3] , 'bold' ] , - \ 'info': [ s:I2[0] , s:I2[1] , s:I2[2] , s:I2[3] , '' ] , - \ 'info_separator': [ s:I2[1] , s:I3[1] , s:I2[3] , s:I3[3] , 'bold' ] , - \ 'statusline': [ s:I3[0] , s:I3[1] , s:I3[2] , s:I3[3] , '' ] , - \ } +let g:airline#themes#dark#insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3) let g:airline#themes#dark#insert_modified = { \ 'info_separator': [ '#005fff' , '#5f005f' , 27 , 53 , '' ] , \ 'statusline': [ '#ffffff' , '#5f005f' , 255 , 53 , '' ] , @@ -42,13 +31,7 @@ let g:airline#themes#dark#insert_replace = { let s:V1 = [ '#000000' , '#ffaf00' , 232 , 214 ] let s:V2 = [ '#000000' , '#ff5f00' , 232 , 202 ] let s:V3 = [ '#ffffff' , '#5f0000' , 15 , 52 ] -let g:airline#themes#dark#visual = { - \ 'mode': [ s:V1[0] , s:V1[1] , s:V1[2] , s:V1[3] , 'bold' ] , - \ 'mode_separator': [ s:V1[1] , s:V2[1] , s:V1[3] , s:V2[3] , 'bold' ] , - \ 'info': [ s:V2[0] , s:V2[1] , s:V2[2] , s:V2[3] , '' ] , - \ 'info_separator': [ s:V2[1] , s:V3[1] , s:V2[3] , s:V3[3] , 'bold' ] , - \ 'statusline': [ s:V3[0] , s:V3[1] , s:V3[2] , s:V3[3] , '' ] , - \ } +let g:airline#themes#dark#visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3) let g:airline#themes#dark#visual_modified = { \ 'info_separator': [ '#ff5f00' , '#5f005f' , 202 , 53 , '' ] , \ 'statusline': [ '#ffffff' , '#5f005f' , 255 , 53 , '' ] , diff --git a/autoload/airline/themes/light.vim b/autoload/airline/themes/light.vim index d49332a..086a5a2 100644 --- a/autoload/airline/themes/light.vim +++ b/autoload/airline/themes/light.vim @@ -3,14 +3,9 @@ let g:airline#themes#light#inactive = { 'mode': [ '#9e9e9e' , '#ffffff' , 247 , let s:N1 = [ '#ffffff' , '#005fff' , 255 , 27 ] let s:N2 = [ '#000087' , '#00dfff' , 18 , 45 ] let s:N3 = [ '#005fff' , '#afffff' , 27 , 159 ] -let g:airline#themes#light#normal = { - \ 'mode': [ s:N1[0] , s:N1[1] , s:N1[2] , s:N1[3] , 'bold' ] , - \ 'mode_separator': [ s:N1[1] , s:N2[1] , s:N1[3] , s:N2[3] , 'bold' ] , - \ 'info': [ s:N2[0] , s:N2[1] , s:N2[2] , s:N2[3] , '' ] , - \ 'info_separator': [ s:N2[1] , s:N3[1] , s:N2[3] , s:N3[3] , 'bold' ] , - \ 'statusline': [ s:N3[0] , s:N3[1] , s:N3[2] , s:N3[3] , '' ] , - \ 'file': [ '#df0000' , '#ffffff' , 160 , 255 , '' ] , - \ } +let g:airline#themes#light#normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) +let g:airline#themes#light#normal.file = [ '#df0000' , '#ffffff' , 160 , 255 , '' ] + let g:airline#themes#light#normal_modified = { \ 'info_separator': [ '#00dfff' , '#ffdfdf' , 45 , 224 , '' ] , \ 'statusline': [ '#df0000' , '#ffdfdf' , 160 , 224 , '' ] , @@ -19,13 +14,7 @@ let g:airline#themes#light#normal_modified = { let s:I1 = [ '#ffffff' , '#00875f' , 255 , 29 ] let s:I2 = [ '#005f00' , '#00df87' , 22 , 42 ] let s:I3 = [ '#005f5f' , '#afff87' , 23 , 156 ] -let g:airline#themes#light#insert = { - \ 'mode': [ s:I1[0] , s:I1[1] , s:I1[2] , s:I1[3] , 'bold' ] , - \ 'mode_separator': [ s:I1[1] , s:I2[1] , s:I1[3] , s:I2[3] , 'bold' ] , - \ 'info': [ s:I2[0] , s:I2[1] , s:I2[2] , s:I2[3] , '' ] , - \ 'info_separator': [ s:I2[1] , s:I3[1] , s:I2[3] , s:I3[3] , 'bold' ] , - \ 'statusline': [ s:I3[0] , s:I3[1] , s:I3[2] , s:I3[3] , '' ] , - \ } +let g:airline#themes#light#insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3) let g:airline#themes#light#insert_modified = { \ 'info_separator': [ '#00df87' , '#ffdfdf' , 42 , 224 , '' ] , \ 'statusline': [ '#df0000' , '#ffdfdf' , 160 , 224 , '' ] , @@ -42,13 +31,7 @@ let g:airline#themes#light#insert_replace = { let s:V1 = [ '#ffffff' , '#ff5f00' , 255 , 202 ] let s:V2 = [ '#5f0000' , '#ffaf00' , 52 , 214 ] let s:V3 = [ '#df5f00' , '#ffff87' , 166 , 228 ] -let g:airline#themes#light#visual = { - \ 'mode': [ s:V1[0] , s:V1[1] , s:V1[2] , s:V1[3] , 'bold' ] , - \ 'mode_separator': [ s:V1[1] , s:V2[1] , s:V1[3] , s:V2[3] , 'bold' ] , - \ 'info': [ s:V2[0] , s:V2[1] , s:V2[2] , s:V2[3] , '' ] , - \ 'info_separator': [ s:V2[1] , s:V3[1] , s:V2[3] , s:V3[3] , 'bold' ] , - \ 'statusline': [ s:V3[0] , s:V3[1] , s:V3[2] , s:V3[3] , '' ] , - \ } +let g:airline#themes#light#visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3) let g:airline#themes#light#visual_modified = { \ 'info_separator': [ '#ffaf00' , '#ffdfdf' , 214 , 224 , '' ] , \ 'statusline': [ '#df0000' , '#ffdfdf' , 160 , 224 , '' ] , diff --git a/autoload/airline/themes/solarized.vim b/autoload/airline/themes/solarized.vim index 257cf0c..9117788 100644 --- a/autoload/airline/themes/solarized.vim +++ b/autoload/airline/themes/solarized.vim @@ -3,14 +3,9 @@ let g:airline#themes#solarized#inactive = { 'mode': [ '#4e4e4e' , '#1c1c1c' , 23 let s:N1 = [ '#fdf6e3' , '#657b83' , 230 , 241 ] let s:N2 = [ '#fdf6e3' , '#93a1a1' , 230 , 245 ] let s:N3 = [ '#657b83' , '#fdf6e3' , 241 , 230 ] -let g:airline#themes#solarized#normal = { - \ 'mode': [ s:N1[0] , s:N1[1] , s:N1[2] , s:N1[3] , 'bold' ] , - \ 'mode_separator': [ s:N1[1] , s:N2[1] , s:N1[3] , s:N2[3] , 'bold' ] , - \ 'info': [ s:N2[0] , s:N2[1] , s:N2[2] , s:N2[3] , '' ] , - \ 'info_separator': [ s:N2[1] , s:N3[1] , s:N2[3] , s:N3[3] , 'bold' ] , - \ 'statusline': [ s:N3[0] , s:N3[1] , s:N3[2] , s:N3[3] , '' ] , - \ 'file': [ '#ff0000' , '#1c1c1c' , 160 , 233 , '' ] , - \ } +let g:airline#themes#solarized#normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) +let g:airline#themes#solarized#normal.file = [ '#ff0000' , '#1c1c1c' , 160 , 233 , '' ] + let g:airline#themes#solarized#normal_modified = { \ 'info_separator': [ '#444444' , '#5f005f' , 238 , 53 , '' ] , \ 'statusline': [ '#ffffff' , '#5f005f' , 255 , 53 , '' ] , @@ -19,13 +14,7 @@ let g:airline#themes#solarized#normal_modified = { let s:I1 = [ '#073642' , '#d33682' , 235 , 125 ] let s:I2 = [ '#073642' , '#268bd2' , 235 , 33 ] let s:I3 = [ '#073642' , '#2aa198' , 235 , 37 ] -let g:airline#themes#solarized#insert = { - \ 'mode': [ s:I1[0] , s:I1[1] , s:I1[2] , s:I1[3] , 'bold' ] , - \ 'mode_separator': [ s:I1[1] , s:I2[1] , s:I1[3] , s:I2[3] , 'bold' ] , - \ 'info': [ s:I2[0] , s:I2[1] , s:I2[2] , s:I2[3] , '' ] , - \ 'info_separator': [ s:I2[1] , s:I3[1] , s:I2[3] , s:I3[3] , 'bold' ] , - \ 'statusline': [ s:I3[0] , s:I3[1] , s:I3[2] , s:I3[3] , '' ] , - \ } +let g:airline#themes#solarized#insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3) let g:airline#themes#solarized#insert_modified = { \ 'info_separator': [ '#005fff' , '#5f005f' , 27 , 53 , '' ] , \ 'statusline': [ '#ffffff' , '#5f005f' , 255 , 53 , '' ] , @@ -34,13 +23,7 @@ let g:airline#themes#solarized#insert_modified = { let s:V1 = [ '#002b36' , '#b58900' , 234 , 136 ] let s:V2 = [ '#073642' , '#cb4b16' , 235 , 166 ] let s:V3 = [ '#fdf6e3' , '#dc322f' , 230 , 160 ] -let g:airline#themes#solarized#visual = { - \ 'mode': [ s:V1[0] , s:V1[1] , s:V1[2] , s:V1[3] , 'bold' ] , - \ 'mode_separator': [ s:V1[1] , s:V2[1] , s:V1[3] , s:V2[3] , 'bold' ] , - \ 'info': [ s:V2[0] , s:V2[1] , s:V2[2] , s:V2[3] , '' ] , - \ 'info_separator': [ s:V2[1] , s:V3[1] , s:V2[3] , s:V3[3] , 'bold' ] , - \ 'statusline': [ s:V3[0] , s:V3[1] , s:V3[2] , s:V3[3] , '' ] , - \ } +let g:airline#themes#solarized#visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3) let g:airline#themes#solarized#visual_modified = { \ 'info_separator': [ '#ff5f00' , '#5f005f' , 202 , 53 , '' ] , \ 'statusline': [ '#ffffff' , '#5f005f' , 255 , 53 , '' ] ,