feat(themes): add theme system with starship integration

- Add theme selection system with 5 predefined themes
- Implement Catppuccin Mocha, Dracula, Gruvbox Dark, Nord, and Tokyo Night
- Each theme includes NvChad integration and starship prompt configuration
- Support for custom color palettes and consistent formatting
- Interactive theme selection with numbered menu
This commit is contained in:
marvin.dietermann
2026-04-10 11:44:34 +02:00
parent c9fa40b31c
commit ee0b7f5009
6 changed files with 490 additions and 0 deletions

30
lib/themes.sh Normal file
View File

@@ -0,0 +1,30 @@
#!/bin/bash
# Theme selection — sources the chosen theme file
THEMES_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/themes"
THEME_FILES=(gruvbox catppuccin tokyonight nord dracula)
select_theme() {
echo " Select colorscheme:"
echo ""
local i=1
for t in "${THEME_FILES[@]}"; do
source "$THEMES_DIR/$t.sh"
printf " %d) %s\n" "$i" "$THEME_DISPLAY_NAME"
i=$((i + 1))
done
echo ""
read -rp " Choice [1-${#THEME_FILES[@]}]: " theme_choice
# Default to 1 (Gruvbox) for invalid input
if [[ ! "$theme_choice" =~ ^[0-9]+$ ]] || ((theme_choice < 1 || theme_choice > ${#THEME_FILES[@]})); then
theme_choice=1
fi
local selected="${THEME_FILES[$((theme_choice - 1))]}"
source "$THEMES_DIR/$selected.sh"
info "Selected theme: $THEME_DISPLAY_NAME"
}

92
lib/themes/catppuccin.sh Normal file
View File

@@ -0,0 +1,92 @@
#!/bin/bash
THEME_DISPLAY_NAME="Catppuccin Mocha"
NVCHAD_THEME="catppuccin"
write_starship_config() {
cat >"$1" <<'TOML'
palette = "catppuccin_mocha"
format = """$directory$git_branch$git_status$character"""
[directory]
style = "bold fg:bright-yellow"
truncation_length = 3
[git_branch]
style = "bold fg:bright-green"
format = " [$branch]($style) "
[git_status]
style = "bold fg:bright-red"
[character]
success_symbol = "[❯](bold fg:bright-green)"
error_symbol = "[❯](bold fg:bright-red)"
[palettes.catppuccin_mocha]
bright-yellow = "#f9e2af"
bright-green = "#a6e3a1"
bright-red = "#f38ba8"
bright-blue = "#89b4fa"
bright-purple = "#cba6f7"
bright-aqua = "#94e2d5"
bright-orange = "#fab387"
TOML
}
write_zellij_config() {
cat >"$1" <<'KDL'
theme "catppuccin-mocha"
default_layout "default"
default_mode "normal"
pane_frames false
simplified_ui true
mouse_mode false
keybinds {
shared {
bind "Alt h" { MoveFocusOrTab "Left"; }
bind "Alt l" { MoveFocusOrTab "Right"; }
bind "Alt j" { MoveFocus "Down"; }
bind "Alt k" { MoveFocus "Up"; }
bind "Alt n" { NewPane "Down"; }
bind "Alt v" { NewPane "Right"; }
bind "Alt f" { ToggleFloatingPanes; }
bind "Alt t" { NewTab; }
}
}
themes {
catppuccin-mocha {
fg "#cdd6f4"
bg "#1e1e2e"
black "#181825"
red "#f38ba8"
green "#a6e3a1"
yellow "#f9e2af"
blue "#89b4fa"
magenta "#cba6f7"
cyan "#94e2d5"
white "#bac2de"
orange "#fab387"
}
}
KDL
}
write_lazygit_config() {
cat >"$1" <<'YAML'
gui:
theme:
activeBorderColor:
- "#f9e2af"
- bold
inactiveBorderColor:
- "#585b70"
selectedLineBgColor:
- "#313244"
cherryPickedCommitFgColor:
- "#a6e3a1"
defaultFgColor:
- "#cdd6f4"
YAML
}

92
lib/themes/dracula.sh Normal file
View File

@@ -0,0 +1,92 @@
#!/bin/bash
THEME_DISPLAY_NAME="Dracula"
NVCHAD_THEME="dracula"
write_starship_config() {
cat >"$1" <<'TOML'
palette = "dracula"
format = """$directory$git_branch$git_status$character"""
[directory]
style = "bold fg:bright-yellow"
truncation_length = 3
[git_branch]
style = "bold fg:bright-green"
format = " [$branch]($style) "
[git_status]
style = "bold fg:bright-red"
[character]
success_symbol = "[❯](bold fg:bright-green)"
error_symbol = "[❯](bold fg:bright-red)"
[palettes.dracula]
bright-yellow = "#f1fa8c"
bright-green = "#50fa7b"
bright-red = "#ff5555"
bright-blue = "#bd93f9"
bright-purple = "#ff79c6"
bright-aqua = "#8be9fd"
bright-orange = "#ffb86c"
TOML
}
write_zellij_config() {
cat >"$1" <<'KDL'
theme "dracula"
default_layout "default"
default_mode "normal"
pane_frames false
simplified_ui true
mouse_mode false
keybinds {
shared {
bind "Alt h" { MoveFocusOrTab "Left"; }
bind "Alt l" { MoveFocusOrTab "Right"; }
bind "Alt j" { MoveFocus "Down"; }
bind "Alt k" { MoveFocus "Up"; }
bind "Alt n" { NewPane "Down"; }
bind "Alt v" { NewPane "Right"; }
bind "Alt f" { ToggleFloatingPanes; }
bind "Alt t" { NewTab; }
}
}
themes {
dracula {
fg "#f8f8f2"
bg "#282a36"
black "#21222c"
red "#ff5555"
green "#50fa7b"
yellow "#f1fa8c"
blue "#bd93f9"
magenta "#ff79c6"
cyan "#8be9fd"
white "#bfbfbf"
orange "#ffb86c"
}
}
KDL
}
write_lazygit_config() {
cat >"$1" <<'YAML'
gui:
theme:
activeBorderColor:
- "#f1fa8c"
- bold
inactiveBorderColor:
- "#6272a4"
selectedLineBgColor:
- "#44475a"
cherryPickedCommitFgColor:
- "#50fa7b"
defaultFgColor:
- "#f8f8f2"
YAML
}

92
lib/themes/gruvbox.sh Normal file
View File

@@ -0,0 +1,92 @@
#!/bin/bash
THEME_DISPLAY_NAME="Gruvbox Dark"
NVCHAD_THEME="gruvbox"
write_starship_config() {
cat >"$1" <<'TOML'
palette = "gruvbox_dark"
format = """$directory$git_branch$git_status$character"""
[directory]
style = "bold fg:bright-yellow"
truncation_length = 3
[git_branch]
style = "bold fg:bright-green"
format = " [$branch]($style) "
[git_status]
style = "bold fg:bright-red"
[character]
success_symbol = "[❯](bold fg:bright-green)"
error_symbol = "[❯](bold fg:bright-red)"
[palettes.gruvbox_dark]
bright-yellow = "#fabd2f"
bright-green = "#b8bb26"
bright-red = "#fb4934"
bright-blue = "#83a598"
bright-purple = "#d3869b"
bright-aqua = "#8ec07c"
bright-orange = "#fe8019"
TOML
}
write_zellij_config() {
cat >"$1" <<'KDL'
theme "gruvbox-dark"
default_layout "default"
default_mode "normal"
pane_frames false
simplified_ui true
mouse_mode false
keybinds {
shared {
bind "Alt h" { MoveFocusOrTab "Left"; }
bind "Alt l" { MoveFocusOrTab "Right"; }
bind "Alt j" { MoveFocus "Down"; }
bind "Alt k" { MoveFocus "Up"; }
bind "Alt n" { NewPane "Down"; }
bind "Alt v" { NewPane "Right"; }
bind "Alt f" { ToggleFloatingPanes; }
bind "Alt t" { NewTab; }
}
}
themes {
gruvbox-dark {
fg "#ebdbb2"
bg "#282828"
black "#1d2021"
red "#cc241d"
green "#98971a"
yellow "#d79921"
blue "#458588"
magenta "#b16286"
cyan "#689d6a"
white "#a89984"
orange "#d65d0e"
}
}
KDL
}
write_lazygit_config() {
cat >"$1" <<'YAML'
gui:
theme:
activeBorderColor:
- "#fabd2f"
- bold
inactiveBorderColor:
- "#665c54"
selectedLineBgColor:
- "#3c3836"
cherryPickedCommitFgColor:
- "#b8bb26"
defaultFgColor:
- "#ebdbb2"
YAML
}

92
lib/themes/nord.sh Normal file
View File

@@ -0,0 +1,92 @@
#!/bin/bash
THEME_DISPLAY_NAME="Nord"
NVCHAD_THEME="nord"
write_starship_config() {
cat >"$1" <<'TOML'
palette = "nord"
format = """$directory$git_branch$git_status$character"""
[directory]
style = "bold fg:bright-yellow"
truncation_length = 3
[git_branch]
style = "bold fg:bright-green"
format = " [$branch]($style) "
[git_status]
style = "bold fg:bright-red"
[character]
success_symbol = "[❯](bold fg:bright-green)"
error_symbol = "[❯](bold fg:bright-red)"
[palettes.nord]
bright-yellow = "#ebcb8b"
bright-green = "#a3be8c"
bright-red = "#bf616a"
bright-blue = "#81a1c1"
bright-purple = "#b48ead"
bright-aqua = "#88c0d0"
bright-orange = "#d08770"
TOML
}
write_zellij_config() {
cat >"$1" <<'KDL'
theme "nord"
default_layout "default"
default_mode "normal"
pane_frames false
simplified_ui true
mouse_mode false
keybinds {
shared {
bind "Alt h" { MoveFocusOrTab "Left"; }
bind "Alt l" { MoveFocusOrTab "Right"; }
bind "Alt j" { MoveFocus "Down"; }
bind "Alt k" { MoveFocus "Up"; }
bind "Alt n" { NewPane "Down"; }
bind "Alt v" { NewPane "Right"; }
bind "Alt f" { ToggleFloatingPanes; }
bind "Alt t" { NewTab; }
}
}
themes {
nord {
fg "#d8dee9"
bg "#2e3440"
black "#3b4252"
red "#bf616a"
green "#a3be8c"
yellow "#ebcb8b"
blue "#81a1c1"
magenta "#b48ead"
cyan "#88c0d0"
white "#e5e9f0"
orange "#d08770"
}
}
KDL
}
write_lazygit_config() {
cat >"$1" <<'YAML'
gui:
theme:
activeBorderColor:
- "#ebcb8b"
- bold
inactiveBorderColor:
- "#4c566a"
selectedLineBgColor:
- "#3b4252"
cherryPickedCommitFgColor:
- "#a3be8c"
defaultFgColor:
- "#d8dee9"
YAML
}

92
lib/themes/tokyonight.sh Normal file
View File

@@ -0,0 +1,92 @@
#!/bin/bash
THEME_DISPLAY_NAME="Tokyo Night"
NVCHAD_THEME="tokyonight"
write_starship_config() {
cat >"$1" <<'TOML'
palette = "tokyonight"
format = """$directory$git_branch$git_status$character"""
[directory]
style = "bold fg:bright-yellow"
truncation_length = 3
[git_branch]
style = "bold fg:bright-green"
format = " [$branch]($style) "
[git_status]
style = "bold fg:bright-red"
[character]
success_symbol = "[❯](bold fg:bright-green)"
error_symbol = "[❯](bold fg:bright-red)"
[palettes.tokyonight]
bright-yellow = "#e0af68"
bright-green = "#9ece6a"
bright-red = "#f7768e"
bright-blue = "#7aa2f7"
bright-purple = "#bb9af7"
bright-aqua = "#7dcfff"
bright-orange = "#ff9e64"
TOML
}
write_zellij_config() {
cat >"$1" <<'KDL'
theme "tokyonight"
default_layout "default"
default_mode "normal"
pane_frames false
simplified_ui true
mouse_mode false
keybinds {
shared {
bind "Alt h" { MoveFocusOrTab "Left"; }
bind "Alt l" { MoveFocusOrTab "Right"; }
bind "Alt j" { MoveFocus "Down"; }
bind "Alt k" { MoveFocus "Up"; }
bind "Alt n" { NewPane "Down"; }
bind "Alt v" { NewPane "Right"; }
bind "Alt f" { ToggleFloatingPanes; }
bind "Alt t" { NewTab; }
}
}
themes {
tokyonight {
fg "#c0caf5"
bg "#1a1b26"
black "#15161e"
red "#f7768e"
green "#9ece6a"
yellow "#e0af68"
blue "#7aa2f7"
magenta "#bb9af7"
cyan "#7dcfff"
white "#a9b1d6"
orange "#ff9e64"
}
}
KDL
}
write_lazygit_config() {
cat >"$1" <<'YAML'
gui:
theme:
activeBorderColor:
- "#e0af68"
- bold
inactiveBorderColor:
- "#3b4261"
selectedLineBgColor:
- "#283457"
cherryPickedCommitFgColor:
- "#9ece6a"
defaultFgColor:
- "#c0caf5"
YAML
}