Files
tmux-themepack/themepack.tmux
Jim Myhrberg ba8616db4c feat: Make all themes easily user-customizable
This is achieved by using custom @-prefixed tmux options which are set
with the `-o` option, meaning, the theme will only set the value if it
is not already set.

This allows users to override any of the options in the theme by simply
setting them before loading the theme.

Additionally all themes are now generated using a custom theme builder,
that allows sharing various parts of themes between them easily.
2019-12-22 10:27:04 +00:00

30 lines
561 B
Bash
Executable File

#!/usr/bin/env bash
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
get-tmux-option() {
local option value default
option="$1"
default="$2"
value="$(tmux show-option -gqv "$option")"
if [ -n "$value" ]; then
echo "$value"
else
echo "$default"
fi
}
main() {
local theme
theme="$(get-tmux-option "@themepack" "basic")"
if [ -f "$CURRENT_DIR/${theme}.tmuxtheme" ]; then
tmux source-file "$CURRENT_DIR/${theme}.tmuxtheme"
else
tmux source-file "$CURRENT_DIR/powerline/${theme}.tmuxtheme"
fi
}
main "$@"