tmux: Use user options to define colors only once

This commit is contained in:
2023-01-04 13:19:07 +01:00
parent b4cbd08d3b
commit c6e988e663

View File

@@ -157,42 +157,46 @@ bind d {
detach detach
} }
## Theming. Inspired by: ## Theming
## https://github.com/Who23/dots/blob/21976e76644d8d9261ebdcf61733d2181a1612eb/tmux.conf set -g @accent_color 'brightyellow'
set -g message-command-style bg=default,fg=brightyellow set -g @ui_color 'brightblack'
set -g message-style bg=brightyellow,fg=black set -g @sync_color 'brightred'
set -g mode-style bg=brightyellow,fg=black set -g @text_fg 'black'
set -g message-command-style 'bg=default,fg=#{@accent_color}'
set -g message-style 'bg=#{@accent_color},fg=#{@text_fg}'
set -g mode-style 'bg=#{@accent_color},fg=#{@text_fg}'
# NOTE: `<` does string comparison with `strcmp()`. This means that the # NOTE: `<` does string comparison with `strcmp()`. This means that the
# condition will break from a double digit major version (e.g. `10.0`) on. # condition will break from a double digit major version (e.g. `10.0`) on.
if -F "#{<:#{version},3.2}" { if -F "#{<:#{version},3.2}" {
# Use pure style default for tmux < 3.2 in combination with the # Use pure style default for tmux < 3.2 in combination with the
# prefix_highlight plugin. # prefix_highlight plugin.
set -g pane-border-style bg=default,fg=brightblack set -g pane-border-style 'bg=default,fg=#{@ui_color}'
set -g pane-active-border-style bg=default,fg=brightyellow set -g pane-active-border-style 'bg=default,fg=#{@accent_color}'
set -g @prefix_highlight_show_copy_mode 'on' set -g @prefix_highlight_show_copy_mode 'on'
set -g @prefix_highlight_show_sync_mode 'on' set -g @prefix_highlight_show_sync_mode 'on'
set -g @prefix_highlight_copy_mode_attr 'fg=black,bg=brightyellow' set -g @prefix_highlight_copy_mode_attr 'fg=#{@text_fg},bg=#{@accent_color}'
set -g @prefix_highlight_sync_mode_attr 'fg=black,bg=brightred' set -g @prefix_highlight_sync_mode_attr 'fg=#{@text_fg},bg=#{@sync_color}'
} { } {
# From 3.2 on, we can use formats in styles, so that all indicators can be # From 3.2 on, we can use formats in styles, so that all indicators can be
# done by the borders. # done by the borders.
set -g pane-border-style "#{?synchronize-panes,fg=brightred,fg=brightblack}" set -g pane-border-style "#{?synchronize-panes,fg=#{@sync_color},fg=#{@ui_color}}"
set -g pane-active-border-style "#{?pane_in_mode,bg=brightyellow#,fg=brightblack,#{?synchronize-panes,fg=brightred,fg=brightyellow}}" set -g pane-active-border-style "#{?pane_in_mode,bg=#{@accent_color}#,fg=#{@ui_color},#{?synchronize-panes,fg=#{@sync_color},fg=#{@accent_color}}}"
} }
# Display in the status bar when the prefix was pressed, copy-mode is active, or # Display in the status bar when the prefix was pressed, copy-mode is active, or
# `synchronize-panes` is turned on # `synchronize-panes` is turned on
set -g @prefix_highlight_fg 'brightyellow' set -g @prefix_highlight_fg '#{@accent_color}'
set -g @prefix_highlight_bg 'default' set -g @prefix_highlight_bg 'default'
set -g status-right "#{prefix_highlight}" set -g status-right "#{prefix_highlight}"
set -g status-left "#{prefix_highlight}" set -g status-left "#{prefix_highlight}"
set -g status-justify centre set -g status-justify centre
set -g window-status-current-format "#[fg=brightyellow bold]#I #W" set -g window-status-current-format "#[fg=#{@accent_color} bold]#I #W"
set -g window-status-format "#[fg=brightblack]#I #W" set -g window-status-format "#[fg=#{@ui_color}]#I #W"
# Initialize TMUX plugin manager. Keep this line at the very bottom. # Initialize TMUX plugin manager. Keep this line at the very bottom.
run -b "$XDG_CONFIG_HOME/tmux/plugins/tpm/tpm" run -b "$XDG_CONFIG_HOME/tmux/plugins/tpm/tpm"