-
Notifications
You must be signed in to change notification settings - Fork 11
Porting Airline Themes
Roger Bongers edited this page Sep 1, 2023
·
2 revisions
Install vim-airline and vim-crystalline and any other plugins you need in your .vimrc
:
call plug#begin()
Plug 'vim-airline/vim-airline'
Plug 'rbong/vim-crystalline'
call plug#end()
Then, set your vim-airline theme, usually by calling :AirlineTheme <theme>
or :colorscheme <theme>
.
Once your theme is loaded, run this to port your theme and copy it to the clipboard:
let @+ = crystalline#PortAirlineTheme('<theme>') | echo @+
The output should look similar to the following:
call crystalline#GenerateTheme({
\ 'A': [[17, 190], ['#00005f', '#dfff00'], 'bold'],
\ 'B': [[255, 238], ['#ffffff', '#444444'], ''],
\ 'Fill': [[85, 234], ['#9cffd3', '#202020'], ''],
\ })
If the theme has light and dark variants, you can run :set bg=light
or :set bg=dark
and repeat these steps.
Put the output in ~/.vim/autload/theme/my_theme.vim
:
function! crystalline#theme#my_theme#SetTheme() abort
if &background ==# 'dark'
" crystalline#GenerateTheme({ ... })
else
" crystalline#GenerateTheme({ ... })
endif
endfunction
Full example: the solarized vim-crystalline theme.