A sleek and modern ZSH theme that automatically adapts to light and dark terminal themes. This theme provides a clean and informative prompt with git integration, command execution time, virtualenv awareness, and a beautiful rainbow directory path.
- Prompt Layout
- Key Features
- Quick Start
- Installation
- Customization
- FAQ
- Contributing
- License
- Author
- Additional Resources
Hereβs how the prompt looks in action:
-
π€ ravindra@~
ravindra= username (yellow)~= home directory root (rainbow-colored)
-
π ~/Projects/zsh-modern-theme Rainbow-colored directory path for quick readability.
- Each path segment = different color
~replaces$HOMEand is rainbow-colored
-
π env:(.venv) Active Python virtual environment.
- Shown only if a venv is active
-
π git:(master) β Git integration:
- Branch name (purple)
- β = clean repo (green)
- β = dirty repo (red)
-
β±οΈ 11:57:08 β 0s Right-aligned time and command execution duration:
- Current time (
%*) - β + elapsed time of last command
- Falls back to
[s]if Unicode isnβt supported
- Current time (
-
β― Prompt symbol:
- Green β― = last command succeeded
- Red β― = last command failed
- π Auto light/dark detection
- π Rainbow directory path with
~for home - π Git branch + status (β/β)
- β±οΈ Time + command duration (β / [s])
- π Python venv awareness
- π€ Username context
- β Success/error colored prompt arrow
- π¨ Color-optimized for common terminals (iTerm2, Apple Terminal, GNOME, Konsole, tmux/screen)
# 1. Clone the repository
git clone https://github.com/BadRat-in/zsh-modern-theme.git $HOME/.zsh/zsh-modern-theme
# 2. Add to your ~/.zshrc
echo 'source $HOME/.zsh/zsh-modern-theme/zsh-modern-theme.zsh' >> ~/.zshrc
# 3. Reload your shell
source ~/.zshrcThat's it! The theme will automatically create a config file at ~/.config/zsh-modern-theme/.config.json with default settings.
- Clone the repository:
git clone https://github.com/BadRat-in/zsh-modern-theme.git $HOME/.zsh/zsh-modern-theme- Source it in your
~/.zshrc:
source $HOME/.zsh/zsh-modern-theme/modern-theme.zsh- Reload ZSH:
source ~/.zshrcYou can customize the theme through configuration files and by overriding variables in your ~/.zshrc.
The theme stores its configuration in ~/.config/zsh-modern-theme/.config.json. The configuration file is automatically created with default settings when you first load the theme.
Configuration file location: ~/.config/zsh-modern-theme/.config.json
- First Time Users: When you first load the theme, it automatically creates the config directory and file with sensible defaults
- If Deleted: If you delete the config file, it will be regenerated with defaults the next time you reload your shell
- Custom Settings: Any changes you make to the config file persist across shell sessions
Here's what the default configuration looks like:
{
"_comment": "ZSH Modern Theme Configuration",
"_description": "This file is automatically generated with default settings. Edit values to customize your prompt.",
"duration_format": "auto",
"_duration_format_options": {
"auto": "Automatically formats based on duration (< 60s shows seconds, >= 60s shows m:s or h:m:s)",
"seconds": "Always show in seconds only (e.g., 83s)",
"minutes-seconds": "Always show in minutes:seconds format (e.g., 1:23)"
},
"git": {
"clean_symbol": "β",
"dirty_symbol": "β",
"show_status": true,
"_symbols_info": "Use Unicode symbols or ASCII alternatives (e.g., '+', 'x', '*')"
},
"virtualenv": {
"show": true,
"_info": "Show Python virtual environment name in prompt"
},
"time": {
"show": true,
"show_command_duration": true,
"timer_icon": "β",
"_timer_icon_options": "Examples: 'β', 'β±οΈ', 'β²οΈ', '[t]', '(s)'"
}
}Note: Fields starting with _ are comments for documentation and are ignored by the parser.
Control how command execution time is displayed:
"duration_format": "auto"Available options:
-
"auto"(default) - Automatically formats based on duration:- Less than 60 seconds: Shows as
25s - 60-3599 seconds: Shows as
2m 35s - 3600+ seconds: Shows as
1h 15m 30s
- Less than 60 seconds: Shows as
-
"seconds"- Always displays in seconds only:- Example:
83s(even for durations over 1 minute) - Useful for precise timing and scripting
- Example:
-
"minutes-seconds"- Always displays inMM:SSformat:- Example:
0:45for 45 seconds,1:23for 83 seconds - More user-friendly for longer commands
- Automatically zero-pads seconds (e.g.,
2:05)
- Example:
π See detailed duration format examples β
Customize git status display:
"git": {
"clean_symbol": "β",
"dirty_symbol": "β",
"show_status": true
}Options:
-
clean_symbol: Symbol shown when git repo is clean (default:"β")- Examples:
"β","β","+","ok","clean"
- Examples:
-
dirty_symbol: Symbol shown when git repo has changes (default:"β")- Examples:
"β","β","x","*","dirty"
- Examples:
-
show_status: Show/hide git status indicator (default:true)- Set to
falseto hide the clean/dirty symbol (only shows branch name)
- Set to
Example - ASCII symbols:
"git": {
"clean_symbol": "+",
"dirty_symbol": "x",
"show_status": true
}Control Python virtualenv display:
"virtualenv": {
"show": true
}Options:
show: Show/hide virtualenv in prompt (default:true)- Set to
falseto hideenv:(venv_name)from prompt
- Set to
Configure time and duration display:
"time": {
"show": true,
"show_command_duration": true,
"timer_icon": "β"
}Options:
-
show: Show/hide current time (default:true)- Set to
falseto hideHH:MM:SSfrom prompt
- Set to
-
show_command_duration: Show/hide command execution duration (default:true)- Set to
falseto hide duration timer
- Set to
-
timer_icon: Icon displayed before duration (default:"β"or"[s]"for non-Unicode terminals)- Unicode examples:
"β","β±οΈ","β²οΈ","β°","π" - ASCII examples:
"[t]","(s)","[s]","T:"
- Unicode examples:
Example - Minimal time display:
"time": {
"show": false,
"show_command_duration": true,
"timer_icon": "[s]"
}This shows only command duration without current time.
Minimal prompt (no time info):
{
"duration_format": "auto",
"git": {
"clean_symbol": "β",
"dirty_symbol": "β",
"show_status": true
},
"virtualenv": {
"show": true
},
"time": {
"show": false,
"show_command_duration": false,
"timer_icon": "β"
}
}ASCII-only symbols:
{
"duration_format": "seconds",
"git": {
"clean_symbol": "+",
"dirty_symbol": "x",
"show_status": true
},
"virtualenv": {
"show": true
},
"time": {
"show": true,
"show_command_duration": true,
"timer_icon": "[s]"
}
}Focus on command duration:
{
"duration_format": "minutes-seconds",
"git": {
"clean_symbol": "β",
"dirty_symbol": "β",
"show_status": false
},
"virtualenv": {
"show": false
},
"time": {
"show": false,
"show_command_duration": true,
"timer_icon": "β±οΈ"
}
}After editing the configuration file, reload your shell:
source ~/.zshrcOr simply start a new terminal session.
The theme auto-selects colors, but you can override:
# Dark theme
typeset -g PROMPT_COLOR=$'%F{033}' # Bright blue
typeset -g USER_COLOR=$'%F{226}' # Bright yellow
# Light theme
typeset -g PROMPT_COLOR=$'%F{033}' # Dark blue
typeset -g USER_COLOR=$'%F{094}' # Dark goldYou can also redefine the rainbow path colors:
typeset -g RAINBOW_COLORS=(
$'%F{208}' # orange
$'%F{220}' # yellow
$'%F{082}' # green
$'%F{039}' # blue
$'%F{171}' # purple
$'%F{033}' # deep blue
)typeset -g GIT_CLEAN_SYMBOL='β'
typeset -g GIT_DIRTY_SYMBOL='β'
typeset -g GIT_SUFFIX='' # optional suffix after branch nameThe theme automatically creates a configuration file at ~/.config/zsh-modern-theme/.config.json with default settings. No manual setup required!
No problem! The theme will automatically regenerate it with default settings the next time you reload your shell. Your prompt will continue working seamlessly.
Yes! Edit your config file and change symbols to ASCII alternatives:
{
"git": {
"clean_symbol": "+",
"dirty_symbol": "x"
},
"time": {
"timer_icon": "[s]"
}
}Set the corresponding show option to false in your config file:
{
"virtualenv": { "show": false },
"time": { "show": false }
}~/.config/zsh-modern-theme/.config.json
Yes! The theme includes special detection for terminal multiplexers and adapts accordingly.
The theme works with all modern terminals and has been tested on:
- iTerm2 (macOS)
- Apple Terminal (macOS)
- GNOME Terminal (Linux)
- Konsole (Linux)
- Alacritty
- Kitty
- tmux/screen
After editing the config file, simply reload your shell:
source ~/.zshrcOr start a new terminal session.
Contributions welcome! PRs and issues encouraged.
See CONTRIBUTING.md for guidelines.
MIT License β see LICENSE.
Ravindra Singh GitHub: @BadRat-in
- Inspired by various ZSH themes in the community
- Thanks to the Oh My Zsh project
- π Detailed Duration Format Examples - Comprehensive examples of all duration formats
- π Contributing Guide - Guidelines for contributing to the project
- π Project Structure - Complete project organization and file descriptions
- π§ͺ Configuration Test Suite - Test script to verify configuration loading
- π§ͺ Duration Format Tests - Test script for duration formatting

