From af3292dbbb6d8abe35d0ad50bd86b6ac6219abb7 Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Fri, 1 Sep 2017 11:27:42 +0200 Subject: [PATCH] include dark_minimal theme --- autoload/airline/themes/dark_minimal.vim | 63 ++++++++++++++++++++++++ doc/airline-themes.txt | 8 +++ 2 files changed, 71 insertions(+) create mode 100644 autoload/airline/themes/dark_minimal.vim diff --git a/autoload/airline/themes/dark_minimal.vim b/autoload/airline/themes/dark_minimal.vim new file mode 100644 index 0000000..6c08628 --- /dev/null +++ b/autoload/airline/themes/dark_minimal.vim @@ -0,0 +1,63 @@ +scriptencoding utf-8 + +" This is a copy of the dark.vim theme, however it does not change colors in +" the different modes, so should bring some performance improvements because +" airline does not have to redefine highlighting groups after they have been +" setup once. + +" Each theme is contained in its own file and declares variables scoped to the +" file. These variables represent the possible "modes" that airline can +" detect. The mode is the return value of mode(), which gets converted to a +" readable string. The following is a list currently supported modes: normal, +" insert, replace, visual, and inactive. +" +" Each mode can also have overrides. These are small changes to the mode that +" don't require a completely different look. "modified" and "paste" are two +" such supported overrides. These are simply suffixed to the major mode, +" separated by an underscore. For example, "normal_modified" would be normal +" mode where the current buffer is modified. +" +" The theming algorithm is a 2-pass system where the mode will draw over all +" parts of the statusline, and then the override is applied after. This means +" it is possible to specify a subset of the theme in overrides, as it will +" simply overwrite the previous colors. If you want simultaneous overrides, +" then they will need to change different parts of the statusline so they do +" 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_minimal#palette = {} + +" 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 +" declared globally. Now let's declare some colors for normal mode and add it +" to the dictionary. The array is in the format: +" [ guifg, guibg, ctermfg, ctermbg, opts ]. See "help attr-list" for valid +" values for the "opt" value. +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_minimal#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) + +" Accents are used to give parts within a section a slightly different look or +" color. Here we are defining a "red" accent, which is used by the 'readonly' +" part by default. Only the foreground colors are specified, so the background +" colors are automatically extracted from the underlying section colors. What +" this means is that regardless of which section the part is defined in, it +" will be red instead of the section's foreground color. You can also have +" multiple parts with accents within a section. +let g:airline#themes#dark_minimal#palette.accents = { + \ 'red': [ '#ff0000' , '' , 160 , '' ] + \ } + +let pal = g:airline#themes#dark_minimal#palette +for item in ['insert', 'replace', 'visual', 'inactive', 'ctrlp'] + " why doesn't this work? + " get E713: cannot use empty key for dictionary + "let pal.{item} = pal.normal + exe "let pal.".item." = pal.normal" + for suffix in ['_modified', '_paste'] + exe "let pal.".item.suffix. " = pal.normal" + endfor +endfor diff --git a/doc/airline-themes.txt b/doc/airline-themes.txt index 63c4d00..eadfc14 100644 --- a/doc/airline-themes.txt +++ b/doc/airline-themes.txt @@ -78,6 +78,7 @@ Currently this repository contains the following themes: * cobalt2 * cool * dark + * dark_minimal * deus * distinguished * durant @@ -127,6 +128,13 @@ g:airline_theme in your |.vimrc| like this: > :let g:airline_theme='dark' < + *airline-theme-dark_minimal* + +This is a copy of the dark.vim theme, however it does not change colors in +the different modes, so should bring some performance improvements because +airline does not have to redefine highlighting groups after they have been +setup once. However, it won't change colors if e.g. the mode changes. + *airline-theme-solarized* *g:solarized_base16*