Provide dynamic color switching
This commit is contained in:
parent
7cf22d650f
commit
29de078156
8 changed files with 100 additions and 4 deletions
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
alacritty/.config/alacritty/alacritty.yml
|
||||||
|
atomaka/.config/atomaka/color.yml
|
8
Makefile
8
Makefile
|
@ -1,8 +1,8 @@
|
||||||
STOWED = bin git ruby tmux vim zsh alacritty
|
STOWED = bin git ruby tmux vim zsh alacritty atomaka
|
||||||
|
|
||||||
all: install
|
all: install
|
||||||
|
|
||||||
install: plug-vim
|
install: plug-vim initialize-colors
|
||||||
stow $(STOWED)
|
stow $(STOWED)
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
|
@ -14,6 +14,10 @@ plug-vim:
|
||||||
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim ; \
|
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim ; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
initialize-colors:
|
||||||
|
cat alacritty/.config/alacritty/alacritty-base.yml alacritty/.config/alacritty/themes/dark.yml > alacritty/.config/alacritty/alacritty.yml
|
||||||
|
cp atomaka/.config/atomaka/color.sample.yml atomaka/.config/atomaka/color.yml
|
||||||
|
|
||||||
rbenv: rbenv-base rbenv-build
|
rbenv: rbenv-base rbenv-build
|
||||||
|
|
||||||
rbenv-base:
|
rbenv-base:
|
||||||
|
|
28
alacritty/.config/alacritty/themes/dark.yml
Normal file
28
alacritty/.config/alacritty/themes/dark.yml
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
# Colors (Solarized Dark)
|
||||||
|
colors:
|
||||||
|
# Default colors
|
||||||
|
primary:
|
||||||
|
background: '0x002b36'
|
||||||
|
foreground: '0x839496'
|
||||||
|
|
||||||
|
# Normal colors
|
||||||
|
normal:
|
||||||
|
black: '0x073642'
|
||||||
|
red: '0xdc322f'
|
||||||
|
green: '0x859900'
|
||||||
|
yellow: '0xb58900'
|
||||||
|
blue: '0x268bd2'
|
||||||
|
magenta: '0xd33682'
|
||||||
|
cyan: '0x2aa198'
|
||||||
|
white: '0xeee8d5'
|
||||||
|
|
||||||
|
# Bright colors
|
||||||
|
bright:
|
||||||
|
black: '0x002b36'
|
||||||
|
red: '0xcb4b16'
|
||||||
|
green: '0x586e75'
|
||||||
|
yellow: '0x657b83'
|
||||||
|
blue: '0x839496'
|
||||||
|
magenta: '0x6c71c4'
|
||||||
|
cyan: '0x93a1a1'
|
||||||
|
white: '0xfdf6e3'
|
28
alacritty/.config/alacritty/themes/light.yml
Normal file
28
alacritty/.config/alacritty/themes/light.yml
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
# Colors (Solarized Light)
|
||||||
|
colors:
|
||||||
|
# Default colors
|
||||||
|
primary:
|
||||||
|
background: '0xfdf6e3'
|
||||||
|
foreground: '0x586e75'
|
||||||
|
|
||||||
|
# Normal colors
|
||||||
|
normal:
|
||||||
|
black: '0x073642'
|
||||||
|
red: '0xdc322f'
|
||||||
|
green: '0x859900'
|
||||||
|
yellow: '0xb58900'
|
||||||
|
blue: '0x268bd2'
|
||||||
|
magenta: '0xd33682'
|
||||||
|
cyan: '0x2aa198'
|
||||||
|
white: '0xeee8d5'
|
||||||
|
|
||||||
|
# Bright colors
|
||||||
|
bright:
|
||||||
|
black: '0x002b36'
|
||||||
|
red: '0xcb4b16'
|
||||||
|
green: '0x586e75'
|
||||||
|
yellow: '0x657b83'
|
||||||
|
blue: '0x839496'
|
||||||
|
magenta: '0x6c71c4'
|
||||||
|
cyan: '0x93a1a1'
|
||||||
|
white: '0xfdf6e3'
|
1
atomaka/.config/atomaka/color.sample.yml
Normal file
1
atomaka/.config/atomaka/color.sample.yml
Normal file
|
@ -0,0 +1 @@
|
||||||
|
dark
|
27
bin/bin/cs
Executable file
27
bin/bin/cs
Executable file
|
@ -0,0 +1,27 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
color_file=$HOME/.config/atomaka/color.yml
|
||||||
|
old_color=$(cat $color_file)
|
||||||
|
|
||||||
|
if [[ $old_color == "dark" ]]; then
|
||||||
|
new_color=light
|
||||||
|
else
|
||||||
|
new_color=dark
|
||||||
|
fi
|
||||||
|
|
||||||
|
alacritty_header=" # Dynamically generated. Edit $HOME/.config/alacritty/alacritty-base.yml"
|
||||||
|
|
||||||
|
alacritty=$HOME/.config/alacritty/
|
||||||
|
echo $alacritty_header > $alacritty/alacritty.yml
|
||||||
|
cat $alacritty/alacritty-base.yml $alacritty/themes/$new_color.yml >> $alacritty/alacritty.yml
|
||||||
|
|
||||||
|
echo $new_color > $color_file
|
||||||
|
|
||||||
|
for pane_info in $(tmux list-panes -a -F '#{pane_id}-#{pane_current_command}'); do
|
||||||
|
IFS=- read pane cmd <<< "$pane_info"
|
||||||
|
|
||||||
|
if [[ $cmd == "vim" ]]; then
|
||||||
|
echo "sending to $pane"
|
||||||
|
tmux send-keys -t $pane ":call ChangeBackground()" ENTER
|
||||||
|
fi
|
||||||
|
done
|
10
vim/.vimrc
10
vim/.vimrc
|
@ -2,7 +2,7 @@
|
||||||
call plug#begin('~/.vim/plugged')
|
call plug#begin('~/.vim/plugged')
|
||||||
|
|
||||||
" colors
|
" colors
|
||||||
Plug 'joshdick/onedark.vim'
|
Plug 'altercation/vim-colors-solarized'
|
||||||
|
|
||||||
" keepers
|
" keepers
|
||||||
Plug 'airblade/vim-gitgutter'
|
Plug 'airblade/vim-gitgutter'
|
||||||
|
@ -167,8 +167,8 @@ set cursorline " Highlight current line
|
||||||
set cursorcolumn " Highlight current column
|
set cursorcolumn " Highlight current column
|
||||||
|
|
||||||
set termguicolors
|
set termguicolors
|
||||||
colorscheme onedark
|
|
||||||
syntax enable
|
syntax enable
|
||||||
|
colorscheme solarized
|
||||||
|
|
||||||
highlight ExtraWhitespace ctermbg=196
|
highlight ExtraWhitespace ctermbg=196
|
||||||
|
|
||||||
|
@ -187,3 +187,9 @@ function! ZoomState()
|
||||||
return ''
|
return ''
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" colors
|
||||||
|
function! ChangeBackground()
|
||||||
|
let &background=readfile(glob("~/.config/atomaka/color.yml"))[0]
|
||||||
|
endfunction
|
||||||
|
call ChangeBackground()
|
||||||
|
|
Loading…
Reference in a new issue