Skip to content

Commit 37c6f1d

Browse files
author
Bruno Sutic
committed
Enable theme configuration via tmux option
Naturally this option will only work if the plugin was loaded with tmux plugin manager.
1 parent c64219f commit 37c6f1d

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

README.md

+6
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ Add plugin to the list of TPM plugins in `.tmux.conf`:
2525

2626
Hit `prefix + I` to fetch the plugin and source it. The plugin should now be working.
2727

28+
3 themes are provided so you can pick and choose via `.tmux.conf` option:
29+
30+
- `set -g @colors-solarized '256'` (the default)
31+
- `set -g @colors-solarized 'dark'`
32+
- `set -g @colors-solarized 'light'`
33+
2834
## Screenshot
2935
Here is a screenshot of a tmux session captured from a gnome-terminal using the [dz-version of the awesome Inconsolata font](http://nodnod.net/2009/feb/12/adding-straight-single-and-double-quotes-inconsola/).
3036

tmuxcolors.tmux

+16-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,22 @@
22

33
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
44

5+
theme_option="@colors-solarized"
6+
default_theme="256"
7+
8+
get_tmux_option() {
9+
local option="$1"
10+
local default_value="$2"
11+
local option_value="$(tmux show-option -gqv "$option")"
12+
if [ -z "$option_value" ]; then
13+
echo "$default_value"
14+
else
15+
echo "$option_value"
16+
fi
17+
}
18+
519
main() {
6-
tmux source-file "$CURRENT_DIR/tmuxcolors-256.conf"
20+
local theme="$(get_tmux_option "$theme_option" "$default_theme")"
21+
tmux source-file "$CURRENT_DIR/tmuxcolors-${theme}.conf"
722
}
823
main

0 commit comments

Comments
 (0)