make tmux status line match background color

This commit is contained in:
Fernando Schauenburg 2019-02-27 02:40:22 +01:00
parent 1c5e7c4e75
commit 54f1df3e90
2 changed files with 41 additions and 27 deletions

View file

@ -25,6 +25,17 @@ bashrc_customize_environment() {
export HISTFILE=~/.bash_eternal_history
}
bashrc_update_colors() {
export BACKGROUND="$1"
bashrc_customize_terminal_colors
bashrc_customize_prompt
bashrc_customize_ls
if [ -n "$TMUX" ] && [ -f "$HOME/.tmux.conf" ]; then
tmux set-environment -g BACKGROUND "$BACKGROUND"
tmux source-file "$HOME/.tmux.conf"
fi
}
bashrc_customize_shell_options() {
for option in cdspell checkwinsize globstar histappend nocaseglob
do
@ -82,6 +93,9 @@ EOS
}
bashrc_customize_aliases() {
alias light='bashrc_update_colors "light"'
alias dark='bashrc_update_colors "dark"'
# Make `ls` group directories first if supported.
if ls --group-directories-first >/dev/null 2>&1; then
alias ls="ls -hF --group-directories-first --color=auto" # GNU
@ -232,22 +246,6 @@ bashrc_customize_ls() {
fi
}
# Change to light background
light() {
export BACKGROUND="light"
bashrc_customize_terminal_colors
bashrc_customize_prompt
bashrc_customize_ls
}
# Change to dark background
dark() {
export BACKGROUND="dark"
bashrc_customize_terminal_colors
bashrc_customize_prompt
bashrc_customize_ls
}
# Print the solarized palette (for testing)
solarized() {
printf "\033[%sm%-7s %-s %2d\033[0m\t" "$base03" Base03 "$base03" 8

View file

@ -52,19 +52,35 @@ set-environment -gu SHLVL
#
# Colors
#
# statusbar colors
set -g status-fg colour12 # Base0
set -g status-bg colour0 # Base02
%if #{==:#{BACKGROUND},light}
# statusbar colors
set -g status-fg colour10
set -g status-bg colour15
# window title colors
setw -g window-status-fg colour12 # Base0
setw -g window-status-bg default # none
setw -g window-status-current-fg colour8 # Base03
setw -g window-status-current-bg colour12 # Base0
# window title colors
setw -g window-status-fg colour10
setw -g window-status-bg default
setw -g window-status-current-fg colour15
setw -g window-status-current-bg colour10
# pane border
set -g pane-border-fg colour6 # Cyan
set -g pane-active-border-fg colour1 # Red
# pane border
set -g pane-border-fg colour6
set -g pane-active-border-fg colour1
%else
# statusbar colors
set -g status-fg colour12
set -g status-bg colour0
# window title colors
setw -g window-status-fg colour12
setw -g window-status-bg default
setw -g window-status-current-fg colour0
setw -g window-status-current-bg colour12
# pane border
set -g pane-border-fg colour6
set -g pane-active-border-fg colour1
%endif
# Apply platform specific configurations:
# See http://www.economyofeffort.com/2013/07/29/reattach-to-user-namespace-the-fix-for-your-tmux-in-os-x-woes/