alacritty-theme

Crates.ioalacritty-theme
lib.rsalacritty-theme
version0.2.0
sourcesrc
created_at2019-12-18 20:02:03.804916
updated_at2020-01-07 18:25:16.462408
descriptionMaking it slightly easier to change Alacritty's color scheme
homepage
repositoryhttps://github.com/davidarmstronglewis/alacritty-theme
max_upload_size
id190375
size41,552
Ocean Armstrong Lewis (oceanlewis)

documentation

README

Alacritty Theme

A simple command line tool to report on and toggle between different color schemes for the terminal emulator Alacritty.

See here for an example of the how you can change your alacritty.yml configuration file to allow for toggling between different colors schemes. Most of the configuration file has been omitted, only the relevant parts remain where there is the addition of a new key color_schemes that is a mapping to different color schemes you want to have available. Node anchors on each scheme allow referencing these schemes by referencing them in the colors attribute.

# Here's a simplified example

color_schemes:
  my_theme: &my_theme
    # Here would be a mapping that Alacritty expects to find in
    # the `colors` attribute, like the one below.

colors: *my_theme

For Vim Users

I'd also like to share how I use this with Vim to align the background of my Vim instance with the background I'm using in Alacritty. It's actually really nice.

For reference, I'm using the Gruvbox color scheme in Vim, which works quite well with light and dark backgrounds.

" This function will set Vim's background to "light" or "dark"
" depending on if the current color scheme Alacritty is using
" has those keywords in its name.
function! AlignBackground()
  let &background = ( system('alacritty-theme current') =~ "light" ? "light" : "dark" )
  hi Normal guibg=NONE ctermbg=NONE
endfunc

" This function will toggle Alacritty's color scheme back and
" forth between light and super_dark themes. You can find them
" in their entirety in `test/alacritty.yml` in this repository.
function! ToggleAlacrittyTheme()
  if (system('alacritty-theme current') =~ "light")
    call system('alacritty-theme change gruvbox_super_dark')
  else
    call system('alacritty-theme change gruvbox_light')
  endif
  call AlignBackground()
endfunc

nmap <leader>l :call ToggleAlacrittyTheme()<cr>

call AlignBackground()
Commit count: 2

cargo fmt