diff --git a/docs/CONFIG.md b/docs/CONFIG.md index 48bd61f3..efc72947 100644 --- a/docs/CONFIG.md +++ b/docs/CONFIG.md @@ -971,3 +971,13 @@ set -g @dracula-weather-hide-errors true For testing/ running custom plugins, put the bash script into the scripts directory of dracula/tmux plugin. Additionally, in the `@dracula-plugins` option, add the script as `custom:name-of-script.sh`. + +Each custom plugin can have its own colors, just like a packaged plugin, by setting +`@dracula-custom--colors "bg fg"` (the `custom-` prefix avoids clashing with a +packaged plugin's own `@dracula--colors` option, should one exist). If unset, it +falls back to `@dracula-custom-plugin-colors "bg fg"`, and then to dracula defaults. + +```bash +set -g @dracula-plugins "custom:docker.sh" +set -g @dracula-custom-docker-colors "blue dark_gray" +``` diff --git a/scripts/dracula.sh b/scripts/dracula.sh index be75feb6..ac5ee1d2 100755 --- a/scripts/dracula.sh +++ b/scripts/dracula.sh @@ -196,7 +196,13 @@ main() { if case $plugin in custom:*) true;; *) false;; esac; then script=${plugin#"custom:"} if [[ -x "${current_dir}/${script}" ]]; then - IFS=' ' read -r -a colors <<<$(get_tmux_option "@dracula-custom-plugin-colors" "cyan dark_gray") + custom_plugin_name=$(basename "${script}") + custom_plugin_name=${custom_plugin_name%.sh} + custom_plugin_colors=$(get_tmux_option "@dracula-custom-${custom_plugin_name}-colors" "") + if [ -z "$custom_plugin_colors" ]; then + custom_plugin_colors=$(get_tmux_option "@dracula-custom-plugin-colors" "cyan dark_gray") + fi + IFS=' ' read -r -a colors <<<"$custom_plugin_colors" script="#($current_dir/${script})" else colors[0]="red"