diff --git a/autoload/lightline/colorscheme/PaperColor.vim b/autoload/lightline/colorscheme/PaperColor.vim index 1b89169..429439d 100644 --- a/autoload/lightline/colorscheme/PaperColor.vim +++ b/autoload/lightline/colorscheme/PaperColor.vim @@ -2,205 +2,9 @@ " Filename: autoload/lightline/colorscheme/PaperColor.vim " Author: TKNGUE " License: MIT License -" Last Change: 2015/07/28 07:12:52. +" Last Change: 2015/07/28 07:35:00. " ============================================================================= -function! s:grey_number(x) - if &t_Co == 88 - if a:x < 23 - return 0 - elseif a:x < 69 - return 1 - elseif a:x < 103 - return 2 - elseif a:x < 127 - return 3 - elseif a:x < 150 - return 4 - elseif a:x < 173 - return 5 - elseif a:x < 196 - return 6 - elseif a:x < 219 - return 7 - elseif a:x < 243 - return 8 - else - return 9 - endif - else - if a:x < 14 - return 0 - else - let n = (a:x - 8) / 10 - let m = (a:x - 8) % 10 - if m < 5 - return n - else - return n + 1 - endif - endif - endif -endfunction - -" Returns the actual grey level represented by the grey index -function! s:grey_level(n) - if &t_Co == 88 - if a:n == 0 - return 0 - elseif a:n == 1 - return 46 - elseif a:n == 2 - return 92 - elseif a:n == 3 - return 115 - elseif a:n == 4 - return 139 - elseif a:n == 5 - return 162 - elseif a:n == 6 - return 185 - elseif a:n == 7 - return 208 - elseif a:n == 8 - return 231 - else - return 255 - endif - else - if a:n == 0 - return 0 - else - return 8 + (a:n * 10) - endif - endif -endfunction - -" Returns the palette index for the given grey index -function! s:grey_color(n) - if &t_Co == 88 - if a:n == 0 - return 16 - elseif a:n == 9 - return 79 - else - return 79 + a:n - endif - else - if a:n == 0 - return 16 - elseif a:n == 25 - return 231 - else - return 231 + a:n - endif - endif -endfunction - -" Returns an approximate color index for the given color level -function! s:rgb_number(x) - if &t_Co == 88 - if a:x < 69 - return 0 - elseif a:x < 172 - return 1 - elseif a:x < 230 - return 2 - else - return 3 - endif - else - if a:x < 75 - return 0 - else - let n = (a:x - 55) / 40 - let m = (a:x - 55) % 40 - if m < 20 - return n - else - return n + 1 - endif - endif - endif -endfunction - -" Returns the actual color level for the given color index -function! s:rgb_level(n) - if &t_Co == 88 - if a:n == 0 - return 0 - elseif a:n == 1 - return 139 - elseif a:n == 2 - return 205 - else - return 255 - endif - else - if a:n == 0 - return 0 - else - return 55 + (a:n * 40) - endif - endif -endfunction - -" Returns the palette index for the given R/G/B color indices -function! s:rgb_color(x, y, z) - if &t_Co == 88 - return 16 + (a:x * 16) + (a:y * 4) + a:z - else - return 16 + (a:x * 36) + (a:y * 6) + a:z - endif -endfunction - -" Returns the palette index to approximate the given R/G/B color levels -function! s:color(r, g, b) - " Get the closest grey - let gx = s:grey_number(a:r) - let gy = s:grey_number(a:g) - let gz = s:grey_number(a:b) - - " Get the closest color - let x = s:rgb_number(a:r) - let y = s:rgb_number(a:g) - let z = s:rgb_number(a:b) - - if gx == gy && gy == gz - " There are two possibilities - let dgr = s:grey_level(gx) - a:r - let dgg = s:grey_level(gy) - a:g - let dgb = s:grey_level(gz) - a:b - let dgrey = (dgr * dgr) + (dgg * dgg) + (dgb * dgb) - let dr = s:rgb_level(gx) - a:r - let dg = s:rgb_level(gy) - a:g - let db = s:rgb_level(gz) - a:b - let drgb = (dr * dr) + (dg * dg) + (db * db) - if dgrey < drgb - " Use the grey - return s:grey_color(gx) - else - " Use the color - return s:rgb_color(x, y, z) - endif - else - " Only one possibility - return s:rgb_color(x, y, z) - endif -endfunction - -" Returns the palette index to approximate the '#rrggbb' hex string -function! s:rgb(rgb) - let r = ("0x" . strpart(a:rgb, 1, 2)) + 0 - let g = ("0x" . strpart(a:rgb, 3, 2)) + 0 - let b = ("0x" . strpart(a:rgb, 5, 2)) + 0 - return s:color(r, g, b) -endfunction - -function! lightline#colorscheme#PaperColor#color(color) - return [a:color, s:rgb(a:color)] -endfunction - if &background ==# 'light' let g:lightline#colorscheme#PaperColor#palette = g:lightline#colorscheme#PaperColor_light#palette else diff --git a/autoload/lightline/colorscheme/PaperColor_dark.vim b/autoload/lightline/colorscheme/PaperColor_dark.vim index 928e5ba..0a70b34 100644 --- a/autoload/lightline/colorscheme/PaperColor_dark.vim +++ b/autoload/lightline/colorscheme/PaperColor_dark.vim @@ -5,56 +5,56 @@ " Last Change: 2015-07-27 06:01 " ============================================================================= -let s:red = lightline#colorscheme#PaperColor#color("#df0000") -let s:green = lightline#colorscheme#PaperColor#color("#008700") -let s:blue = lightline#colorscheme#PaperColor#color("#00afaf") +let s:red = '#df0000' +let s:green = '#008700' +let s:blue = '#00afaf' -let s:pink = lightline#colorscheme#PaperColor#color("#afdf00") -let s:olive = lightline#colorscheme#PaperColor#color("#dfaf5f") -let s:navy = lightline#colorscheme#PaperColor#color("#df875f") +let s:pink = '#afdf00' +let s:olive = '#dfaf5f' +let s:navy = '#df875f' -let s:orange = lightline#colorscheme#PaperColor#color("#d75f00") -let s:purple = lightline#colorscheme#PaperColor#color("#8959a8") -let s:aqua = lightline#colorscheme#PaperColor#color("#3e999f") +let s:orange = '#d75f00' +let s:purple = '#8959a8' +let s:aqua = '#3e999f' " Basics: -let s:foreground = lightline#colorscheme#PaperColor#color("#d0d0d0") -let s:background = lightline#colorscheme#PaperColor#color("#444444") -let s:window = lightline#colorscheme#PaperColor#color("#efefef") -let s:status = lightline#colorscheme#PaperColor#color("#c6c6c6") -let s:error = lightline#colorscheme#PaperColor#color("#5f0000") +let s:foreground = '#d0d0d0' +let s:background = '#444444' +let s:window = '#efefef' +let s:status = '#c6c6c6' +let s:error = '#5f0000' " Tabline: -let s:tabline_bg = lightline#colorscheme#PaperColor#color("#3a3a3a") -let s:tabline_active_fg = lightline#colorscheme#PaperColor#color("#1c1c1c") -let s:tabline_active_bg = lightline#colorscheme#PaperColor#color("#00afaf") -let s:tabline_inactive_fg = lightline#colorscheme#PaperColor#color("#c6c6c6") -let s:tabline_inactive_bg = lightline#colorscheme#PaperColor#color("#585858") +let s:tabline_bg = '#3a3a3a' +let s:tabline_active_fg = '#1c1c1c' +let s:tabline_active_bg = '#00afaf' +let s:tabline_inactive_fg = '#c6c6c6' +let s:tabline_inactive_bg = '#585858' " Statusline: -let s:statusline_active_fg = lightline#colorscheme#PaperColor#color("#1c1c1c") -let s:statusline_active_bg = lightline#colorscheme#PaperColor#color("#5f8787") -let s:statusline_inactive_fg = lightline#colorscheme#PaperColor#color("#c6c6c6") -let s:statusline_inactive_bg = lightline#colorscheme#PaperColor#color("#444444") +let s:statusline_active_fg = '#1c1c1c' +let s:statusline_active_bg = '#5f8787' +let s:statusline_inactive_fg = '#c6c6c6' +let s:statusline_inactive_bg = '#444444' " Visual: -let s:visual_fg = lightline#colorscheme#PaperColor#color("#000000") -let s:visual_bg = lightline#colorscheme#PaperColor#color("#8787af") +let s:visual_fg = '#000000' +let s:visual_bg = '#8787af' let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}} -let s:p.normal.left = [ [ s:foreground, s:background ], [ s:statusline_active_fg, s:status ], [ s:statusline_active_fg, s:statusline_active_bg ] ] -let s:p.normal.right = [ [ s:foreground, s:background ], [ s:statusline_active_fg, s:status ], [ s:statusline_active_fg, s:statusline_active_bg ] ] -let s:p.normal.middle = [ [ s:statusline_active_fg, s:statusline_active_bg ]] -let s:p.inactive.right = [ [ s:foreground, s:background ], [ s:foreground, s:background ] ] -let s:p.inactive.left = [ [ s:foreground, s:background ], [ s:foreground, s:background ] ] +let s:p.normal.left = [ [ s:foreground, s:background ], [ s:statusline_active_fg, s:status ], [ s:statusline_active_fg, s:statusline_active_bg ] ] +let s:p.normal.right = [ [ s:foreground, s:background ], [ s:statusline_active_fg, s:status ], [ s:statusline_active_fg, s:statusline_active_bg ] ] +let s:p.normal.middle = [ [ s:statusline_active_fg, s:statusline_active_bg ]] +let s:p.inactive.right = [ [ s:foreground, s:background ], [ s:foreground, s:background ] ] +let s:p.inactive.left = [ [ s:foreground, s:background ], [ s:foreground, s:background ] ] let s:p.inactive.middle = [ [ s:foreground, s:background ], ] -let s:p.insert.left = [ [ s:background, s:blue], [ s:statusline_active_fg, s:status ], [ s:statusline_active_fg, s:statusline_active_bg ] ] -let s:p.replace.left = [ [ s:background, s:pink ], [s:statusline_active_fg, s:status ], [ s:statusline_active_fg, s:statusline_active_bg ] ] -let s:p.visual.left = [ [ s:visual_fg, s:visual_bg ], [s:statusline_active_fg, s:status ], [ s:statusline_active_fg, s:statusline_active_bg ] ] -let s:p.tabline.left = [ [s:tabline_inactive_fg, s:tabline_inactive_bg ]] -let s:p.tabline.tabsel = [ [s:tabline_active_fg, s:tabline_active_bg ] ] -let s:p.tabline.middle = [ [s:tabline_bg, s:tabline_bg]] -let s:p.tabline.right = copy(s:p.normal.right) -let s:p.normal.error = [ [ s:background, s:error ] ] +let s:p.insert.left = [ [ s:background, s:blue], [ s:statusline_active_fg, s:status ], [ s:statusline_active_fg, s:statusline_active_bg ] ] +let s:p.replace.left = [ [ s:background, s:pink ], [s:statusline_active_fg, s:status ], [ s:statusline_active_fg, s:statusline_active_bg ] ] +let s:p.visual.left = [ [ s:visual_fg, s:visual_bg ], [s:statusline_active_fg, s:status ], [ s:statusline_active_fg, s:statusline_active_bg ] ] +let s:p.tabline.left = [ [s:tabline_inactive_fg, s:tabline_inactive_bg ]] +let s:p.tabline.tabsel = [ [s:tabline_active_fg, s:tabline_active_bg ] ] +let s:p.tabline.middle = [ [s:tabline_bg, s:tabline_bg]] +let s:p.tabline.right = copy(s:p.normal.right) +let s:p.normal.error = [ [ s:background, s:error ] ] -let g:lightline#colorscheme#PaperColor_dark#palette = lightline#colorscheme#flatten(s:p) +let g:lightline#colorscheme#PaperColor_dark#palette = lightline#colorscheme#fill(s:p) diff --git a/autoload/lightline/colorscheme/PaperColor_light.vim b/autoload/lightline/colorscheme/PaperColor_light.vim index 32b243e..d48be45 100644 --- a/autoload/lightline/colorscheme/PaperColor_light.vim +++ b/autoload/lightline/colorscheme/PaperColor_light.vim @@ -2,59 +2,59 @@ " Filename: autoload/lightline/colorscheme/PaperColor_light.vim " Author: TKNGUE " License: MIT License -" Last Change: 2015/07/28 07:12:26. +" Last Change: 2015/07/28 07:38:57. " ============================================================================= -let s:red = lightline#colorscheme#PaperColor#color("#df0000") "Include/Exception -let s:green = lightline#colorscheme#PaperColor#color("#008700") "Boolean/Special -let s:blue = lightline#colorscheme#PaperColor#color("#4271ae") "Keyword -let s:pink = lightline#colorscheme#PaperColor#color("#d7005f") "Type -let s:olive = lightline#colorscheme#PaperColor#color("#718c00") "String -let s:navy = lightline#colorscheme#PaperColor#color("#005f87") "StorageClass -let s:orange = lightline#colorscheme#PaperColor#color("#d75f00") "Number -let s:purple = lightline#colorscheme#PaperColor#color("#8959a8") "Repeat/Conditional -let s:aqua = lightline#colorscheme#PaperColor#color("#3e999f") "Operator/Delimiter +let s:red = '#df0000' +let s:green = '#008700' +let s:blue = '#4271ae' +let s:pink = '#d7005f' +let s:olive = '#718c00' +let s:navy = '#005f87' +let s:orange = '#d75f00' +let s:purple = '#8959a8' +let s:aqua = '#3e999f' " Basics: -let s:foreground = lightline#colorscheme#PaperColor#color("#4d4d4c") -let s:background = lightline#colorscheme#PaperColor#color("#F5F5F5") -let s:window = lightline#colorscheme#PaperColor#color("#efefef") -let s:status = s:aqua -let s:error = lightline#colorscheme#PaperColor#color("#ffafdf") +let s:foreground = '#4d4d4c' +let s:background = '#F5F5F5' +let s:window = '#efefef' +let s:status = s:aqua +let s:error = '#ffafdf' " Tabline: -let s:tabline_bg = s:navy -let s:tabline_active_fg = s:foreground -let s:tabline_active_bg = s:window +let s:tabline_bg = s:navy +let s:tabline_active_fg = s:foreground +let s:tabline_active_bg = s:window let s:tabline_inactive_fg = s:background let s:tabline_inactive_bg = s:aqua " Statusline: -let s:statusline_active_fg = s:window -let s:statusline_active_bg = s:navy +let s:statusline_active_fg = s:window +let s:statusline_active_bg = s:navy let s:statusline_inactive_fg = s:foreground -let s:statusline_inactive_bg = lightline#colorscheme#PaperColor#color("#dadada") +let s:statusline_inactive_bg = '#dadada' " Visual: let s:visual_fg = s:background let s:visual_bg = s:blue let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}} -let s:p.normal.left = [ [ s:foreground, s:background ], [ s:statusline_active_fg, s:status ], [ s:statusline_active_fg, s:statusline_active_bg ] ] -let s:p.normal.right = [ [ s:foreground, s:background ], [ s:statusline_active_fg, s:status ], [ s:statusline_active_fg, s:statusline_active_bg ] ] -let s:p.normal.middle = [ [ s:statusline_active_fg, s:statusline_active_bg ]] -let s:p.inactive.right = [ [ s:foreground, s:background ], [ s:foreground, s:background ] ] -let s:p.inactive.left = [ [ s:foreground, s:background ], [ s:foreground, s:background ] ] +let s:p.normal.left = [ [ s:foreground, s:background ], [ s:statusline_active_fg, s:status ], [ s:statusline_active_fg, s:statusline_active_bg ] ] +let s:p.normal.right = [ [ s:foreground, s:background ], [ s:statusline_active_fg, s:status ], [ s:statusline_active_fg, s:statusline_active_bg ] ] +let s:p.normal.middle = [ [ s:statusline_active_fg, s:statusline_active_bg ]] +let s:p.inactive.right = [ [ s:foreground, s:background ], [ s:foreground, s:background ] ] +let s:p.inactive.left = [ [ s:foreground, s:background ], [ s:foreground, s:background ] ] let s:p.inactive.middle = [ [ s:foreground, s:background ], ] -let s:p.insert.left = [ [ s:blue, s:background ], [ s:statusline_active_fg, s:status ], [ s:statusline_active_fg, s:statusline_active_bg ] ] -let s:p.replace.left = [ [ s:background, s:pink ], [s:statusline_active_fg, s:status ], [ s:statusline_active_fg, s:statusline_active_bg ] ] -let s:p.visual.left = [ [ s:background, s:blue ], [s:statusline_active_fg, s:status ], [ s:statusline_active_fg, s:statusline_active_bg ] ] -let s:p.tabline.left = [ [s:tabline_inactive_fg, s:tabline_inactive_bg ]] -let s:p.tabline.tabsel = [ [s:tabline_active_fg, s:tabline_active_bg ] ] -let s:p.tabline.middle = [ [s:tabline_bg, s:tabline_bg]] -let s:p.tabline.right = copy(s:p.normal.right) -let s:p.normal.error = [ [ s:background, s:error ] ] -let s:p.normal.warning = [ [ s:background, s:olive ] ] +let s:p.insert.left = [ [ s:blue, s:background ], [ s:statusline_active_fg, s:status ], [ s:statusline_active_fg, s:statusline_active_bg ] ] +let s:p.replace.left = [ [ s:background, s:pink ], [s:statusline_active_fg, s:status ], [ s:statusline_active_fg, s:statusline_active_bg ] ] +let s:p.visual.left = [ [ s:background, s:blue ], [s:statusline_active_fg, s:status ], [ s:statusline_active_fg, s:statusline_active_bg ] ] +let s:p.tabline.left = [ [s:tabline_inactive_fg, s:tabline_inactive_bg ]] +let s:p.tabline.tabsel = [ [s:tabline_active_fg, s:tabline_active_bg ] ] +let s:p.tabline.middle = [ [s:tabline_bg, s:tabline_bg]] +let s:p.tabline.right = copy(s:p.normal.right) +let s:p.normal.error = [ [ s:background, s:error ] ] +let s:p.normal.warning = [ [ s:background, s:olive ] ] -let g:lightline#colorscheme#PaperColor_light#palette = lightline#colorscheme#flatten(s:p) +let g:lightline#colorscheme#PaperColor_light#palette = lightline#colorscheme#fill(s:p)