mirror of
https://github.com/vim-airline/vim-airline.git
synced 2025-07-27 07:54:44 +02:00
introduce accents into the color palette.
This commit is contained in:
parent
e31d5f333c
commit
7e7766ee45
0
autoload/airline/extensions.vim
Executable file → Normal file
0
autoload/airline/extensions.vim
Executable file → Normal file
@ -64,7 +64,7 @@ function! airline#init#bootstrap()
|
|||||||
call airline#parts#define_function('filetype', 'airline#parts#filetype')
|
call airline#parts#define_function('filetype', 'airline#parts#filetype')
|
||||||
call airline#parts#define('readonly', {
|
call airline#parts#define('readonly', {
|
||||||
\ 'function': 'airline#parts#readonly',
|
\ 'function': 'airline#parts#readonly',
|
||||||
\ 'highlight': 'airline_file',
|
\ 'accent': 'red',
|
||||||
\ })
|
\ })
|
||||||
call airline#parts#define_raw('file', '%f%m')
|
call airline#parts#define_raw('file', '%f%m')
|
||||||
call airline#parts#define_function('ffenc', 'airline#parts#ffenc')
|
call airline#parts#define_function('ffenc', 'airline#parts#ffenc')
|
||||||
|
@ -2,26 +2,24 @@
|
|||||||
" vim: et ts=2 sts=2 sw=2
|
" vim: et ts=2 sts=2 sw=2
|
||||||
|
|
||||||
" generates a dictionary which defines the colors for each highlight group
|
" generates a dictionary which defines the colors for each highlight group
|
||||||
function! airline#themes#generate_color_map(section1, section2, section3, ...)
|
function! airline#themes#generate_color_map(sect1, sect2, sect3, ...)
|
||||||
let palette = {
|
let palette = {
|
||||||
\ 'airline_a': [ a:section1[0] , a:section1[1] , a:section1[2] , a:section1[3] , get(a:section1 , 4 , 'bold') ] ,
|
\ 'airline_a': [ a:sect1[0] , a:sect1[1] , a:sect1[2] , a:sect1[3] , get(a:sect1 , 4 , 'bold') ] ,
|
||||||
\ 'airline_b': [ a:section2[0] , a:section2[1] , a:section2[2] , a:section2[3] , get(a:section2 , 4 , '' ) ] ,
|
\ 'airline_b': [ a:sect2[0] , a:sect2[1] , a:sect2[2] , a:sect2[3] , get(a:sect2 , 4 , '' ) ] ,
|
||||||
\ 'airline_c': [ a:section3[0] , a:section3[1] , a:section3[2] , a:section3[3] , get(a:section3 , 4 , '' ) ] ,
|
\ 'airline_c': [ a:sect3[0] , a:sect3[1] , a:sect3[2] , a:sect3[3] , get(a:sect3 , 4 , '' ) ] ,
|
||||||
\ }
|
\ }
|
||||||
|
|
||||||
if a:0 > 1
|
if a:0 > 0
|
||||||
call extend(palette, {
|
call extend(palette, {
|
||||||
\ 'airline_x': [ a:1[0] , a:1[1] , a:1[2] , a:1[3] , get(a:1 , 4 , '' ) ] ,
|
\ 'airline_x': [ a:1[0] , a:1[1] , a:1[2] , a:1[3] , get(a:1 , 4 , '' ) ] ,
|
||||||
\ 'airline_y': [ a:2[0] , a:2[1] , a:2[2] , a:2[3] , get(a:2 , 4 , '' ) ] ,
|
\ 'airline_y': [ a:2[0] , a:2[1] , a:2[2] , a:2[3] , get(a:2 , 4 , '' ) ] ,
|
||||||
\ 'airline_z': [ a:3[0] , a:3[1] , a:3[2] , a:3[3] , get(a:3 , 4 , '' ) ] ,
|
\ 'airline_z': [ a:3[0] , a:3[1] , a:3[2] , a:3[3] , get(a:3 , 4 , '' ) ] ,
|
||||||
\ 'airline_file': [ a:4[0] , a:4[1] , a:4[2] , a:4[3] , get(a:4 , 4 , '' ) ] ,
|
|
||||||
\ })
|
\ })
|
||||||
else
|
else
|
||||||
call extend(palette, {
|
call extend(palette, {
|
||||||
\ 'airline_file': [ a:1[0] , a:1[1] , a:1[2] , a:1[3] , get(a:1 , 4 , '' ) ] ,
|
\ 'airline_x': [ a:sect3[0] , a:sect3[1] , a:sect3[2] , a:sect3[3] , get(a:sect3 , 4 , '' ) ] ,
|
||||||
\ 'airline_x': [ a:section3[0] , a:section3[1] , a:section3[2] , a:section3[3] , get(a:section3 , 4 , '' ) ] ,
|
\ 'airline_y': [ a:sect2[0] , a:sect2[1] , a:sect2[2] , a:sect2[3] , get(a:sect2 , 4 , '' ) ] ,
|
||||||
\ 'airline_y': [ a:section2[0] , a:section2[1] , a:section2[2] , a:section2[3] , get(a:section2 , 4 , '' ) ] ,
|
\ 'airline_z': [ a:sect1[0] , a:sect1[1] , a:sect1[2] , a:sect1[3] , get(a:sect1 , 4 , '' ) ] ,
|
||||||
\ 'airline_z': [ a:section1[0] , a:section1[1] , a:section1[2] , a:section1[3] , get(a:section1 , 4 , '' ) ] ,
|
|
||||||
\ })
|
\ })
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -16,35 +16,22 @@
|
|||||||
" simply overwrite the previous colors. If you want simultaneous overrides,
|
" simply overwrite the previous colors. If you want simultaneous overrides,
|
||||||
" then they will need to change different parts of the statusline so they do
|
" then they will need to change different parts of the statusline so they do
|
||||||
" not conflict with each other.
|
" not conflict with each other.
|
||||||
|
"
|
||||||
|
" First, let's define an empty dictionary and assign it to the "palette"
|
||||||
|
" variable. The # is a separator that maps with the directory structure. If
|
||||||
|
" you get this wrong, Vim will complain loudly.
|
||||||
|
let g:airline#themes#dark#palette = {}
|
||||||
|
|
||||||
" First let's define some arrays. The s: is just a VimL thing for scoping the
|
" First let's define some arrays. The s: is just a VimL thing for scoping the
|
||||||
" variables to the current script. Without this, these variables would be
|
" variables to the current script. Without this, these variables would be
|
||||||
" declared globally.
|
" declared globally. Now let's declare some colors for normal mode and add it
|
||||||
"
|
" to the dictionary. The array is in the format:
|
||||||
" The array is in the format [ guifg, guibg, ctermfg, ctermbg, opts ].
|
" [ guifg, guibg, ctermfg, ctermbg, opts ]. See "help attr-list" for valid
|
||||||
" The opts takes in values from ":help attr-list".
|
" values for the "opt" value.
|
||||||
let s:N1 = [ '#00005f' , '#dfff00' , 17 , 190 ]
|
let s:N1 = [ '#00005f' , '#dfff00' , 17 , 190 ]
|
||||||
let s:N2 = [ '#ffffff' , '#444444' , 255 , 238 ]
|
let s:N2 = [ '#ffffff' , '#444444' , 255 , 238 ]
|
||||||
let s:N3 = [ '#9cffd3' , '#202020' , 85 , 234 ]
|
let s:N3 = [ '#9cffd3' , '#202020' , 85 , 234 ]
|
||||||
|
let g:airline#themes#dark#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3)
|
||||||
" The file array is a special case, where only the foreground colors are
|
|
||||||
" specified. The background colors are automatically filled.
|
|
||||||
let s:file = [ '#ff0000' , '' , 160 , '' ]
|
|
||||||
|
|
||||||
" vim-airline is made up of multiple sections, but for theming purposes there
|
|
||||||
" is only 3 sections: the mode, the branch indicator, and the gutter (which
|
|
||||||
" then get mirrored on the right side). generate_color_map is a helper
|
|
||||||
" function which generates a dictionary which declares the full colorscheme
|
|
||||||
" for the statusline. See the source code of "autoload/airline/themes.vim"
|
|
||||||
" for the full set of keys available for theming.
|
|
||||||
|
|
||||||
" First, let's define a palette. Airline will search for this variable.
|
|
||||||
" The # is a separator that maps with the directory structure. If you get
|
|
||||||
" this wrong, Vim will complain loudly.
|
|
||||||
let g:airline#themes#dark#palette = {}
|
|
||||||
|
|
||||||
" Now let's declare some colors for normal mode and add it to the dictionary.
|
|
||||||
let g:airline#themes#dark#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3, s:file)
|
|
||||||
|
|
||||||
" Here we define overrides for when the buffer is modified. This will be
|
" Here we define overrides for when the buffer is modified. This will be
|
||||||
" applied after g:airline#themes#dark#palette.normal, hence why only certain keys are
|
" applied after g:airline#themes#dark#palette.normal, hence why only certain keys are
|
||||||
@ -57,7 +44,7 @@ let g:airline#themes#dark#palette.normal_modified = {
|
|||||||
let s:I1 = [ '#00005f' , '#00dfff' , 17 , 45 ]
|
let s:I1 = [ '#00005f' , '#00dfff' , 17 , 45 ]
|
||||||
let s:I2 = [ '#ffffff' , '#005fff' , 255 , 27 ]
|
let s:I2 = [ '#ffffff' , '#005fff' , 255 , 27 ]
|
||||||
let s:I3 = [ '#ffffff' , '#000080' , 15 , 17 ]
|
let s:I3 = [ '#ffffff' , '#000080' , 15 , 17 ]
|
||||||
let g:airline#themes#dark#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3, s:file)
|
let g:airline#themes#dark#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3)
|
||||||
let g:airline#themes#dark#palette.insert_modified = {
|
let g:airline#themes#dark#palette.insert_modified = {
|
||||||
\ 'airline_c': [ '#ffffff' , '#5f005f' , 255 , 53 , '' ] ,
|
\ 'airline_c': [ '#ffffff' , '#5f005f' , 255 , 53 , '' ] ,
|
||||||
\ }
|
\ }
|
||||||
@ -74,7 +61,7 @@ let g:airline#themes#dark#palette.replace_modified = g:airline#themes#dark#palet
|
|||||||
let s:V1 = [ '#000000' , '#ffaf00' , 232 , 214 ]
|
let s:V1 = [ '#000000' , '#ffaf00' , 232 , 214 ]
|
||||||
let s:V2 = [ '#000000' , '#ff5f00' , 232 , 202 ]
|
let s:V2 = [ '#000000' , '#ff5f00' , 232 , 202 ]
|
||||||
let s:V3 = [ '#ffffff' , '#5f0000' , 15 , 52 ]
|
let s:V3 = [ '#ffffff' , '#5f0000' , 15 , 52 ]
|
||||||
let g:airline#themes#dark#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3, s:file)
|
let g:airline#themes#dark#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3)
|
||||||
let g:airline#themes#dark#palette.visual_modified = {
|
let g:airline#themes#dark#palette.visual_modified = {
|
||||||
\ 'airline_c': [ '#ffffff' , '#5f005f' , 255 , 53 , '' ] ,
|
\ 'airline_c': [ '#ffffff' , '#5f005f' , 255 , 53 , '' ] ,
|
||||||
\ }
|
\ }
|
||||||
@ -83,12 +70,20 @@ let g:airline#themes#dark#palette.visual_modified = {
|
|||||||
let s:IA1 = [ '#4e4e4e' , '#1c1c1c' , 239 , 234 , '' ]
|
let s:IA1 = [ '#4e4e4e' , '#1c1c1c' , 239 , 234 , '' ]
|
||||||
let s:IA2 = [ '#4e4e4e' , '#262626' , 239 , 235 , '' ]
|
let s:IA2 = [ '#4e4e4e' , '#262626' , 239 , 235 , '' ]
|
||||||
let s:IA3 = [ '#4e4e4e' , '#303030' , 239 , 236 , '' ]
|
let s:IA3 = [ '#4e4e4e' , '#303030' , 239 , 236 , '' ]
|
||||||
let g:airline#themes#dark#palette.inactive = airline#themes#generate_color_map(s:IA1, s:IA2, s:IA3, s:file)
|
let g:airline#themes#dark#palette.inactive = airline#themes#generate_color_map(s:IA1, s:IA2, s:IA3)
|
||||||
let g:airline#themes#dark#palette.inactive_modified = {
|
let g:airline#themes#dark#palette.inactive_modified = {
|
||||||
\ 'airline_c': [ '#875faf' , '' , 97 , '' , '' ] ,
|
\ 'airline_c': [ '#875faf' , '' , 97 , '' , '' ] ,
|
||||||
\ }
|
\ }
|
||||||
|
|
||||||
|
|
||||||
|
" Accents are used to give parts within a section a slightly different look.
|
||||||
|
" Here we are defining a "red" accent, which is used by the 'readonly' part by
|
||||||
|
" default.
|
||||||
|
let g:airline#themes#dark#palette.accents = {
|
||||||
|
\ 'red': [ '#ff0000' , '' , 160 , '' ]
|
||||||
|
\ }
|
||||||
|
|
||||||
|
|
||||||
" Here we define the color map for ctrlp. We check for the g:loaded_ctrlp
|
" Here we define the color map for ctrlp. We check for the g:loaded_ctrlp
|
||||||
" variable so that related functionality is loaded iff the user is using
|
" variable so that related functionality is loaded iff the user is using
|
||||||
" ctrlp. Note that this is optional, and if you do not define ctrlp colors
|
" ctrlp. Note that this is optional, and if you do not define ctrlp colors
|
||||||
|
Loading…
x
Reference in New Issue
Block a user