Modern ZSH Theme
October 20, 2025 Β· View on GitHub
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.
Table of Contents
- Prompt Layout
- Key Features
- Quick Start
- Installation
- Customization
- FAQ
- Contributing
- License
- Author
- Additional Resources
Prompt Layout
Hereβs how the prompt looks in action:

Legend
-
π€ 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
Key Features (shortened)
- π 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)
Quick Start
# 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 ~/.zshrc
That's it! The theme will automatically create a config file at ~/.config/zsh-modern-theme/.config.json with default settings.
Installation
Manual Installation
- 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 ~/.zshrc
Customization
You can customize the theme through configuration files and by overriding variables in your ~/.zshrc.
Configuration File
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
How Configuration Works
- 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
Default Configuration
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.
Configuration Options
1. Duration Format
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 β
2. Git Configuration
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
}
3. Virtual Environment
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
4. Time Display
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.
Example Configurations
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": "β±οΈ"
}
}
Applying Configuration Changes
After editing the configuration file, reload your shell:
source ~/.zshrc
Or simply start a new terminal session.
Colors
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 gold
You 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
)
Git Symbols
typeset -g GIT_CLEAN_SYMBOL='β'
typeset -g GIT_DIRTY_SYMBOL='β'
typeset -g GIT_SUFFIX='' # optional suffix after branch name
FAQ
What happens on first install?
The theme automatically creates a configuration file at ~/.config/zsh-modern-theme/.config.json with default settings. No manual setup required!
What if I delete the config file?
No problem! The theme will automatically regenerate it with default settings the next time you reload your shell. Your prompt will continue working seamlessly.
Can I use ASCII symbols instead of Unicode?
Yes! Edit your config file and change symbols to ASCII alternatives:
{
"git": {
"clean_symbol": "+",
"dirty_symbol": "x"
},
"time": {
"timer_icon": "[s]"
}
}
How do I hide certain elements?
Set the corresponding show option to false in your config file:
{
"virtualenv": { "show": false },
"time": { "show": false }
}
Where is the config file located?
~/.config/zsh-modern-theme/.config.json
Does it work with tmux/screen?
Yes! The theme includes special detection for terminal multiplexers and adapts accordingly.
What terminals are supported?
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
How do I reload my configuration?
After editing the config file, simply reload your shell:
source ~/.zshrc
Or start a new terminal session.
Contributing
Contributions welcome! PRs and issues encouraged.
See CONTRIBUTING.md for guidelines.
License
MIT License β see LICENSE.
Author
Ravindra Singh GitHub: @BadRat-in
Acknowledgments
- Inspired by various ZSH themes in the community
- Thanks to the Oh My Zsh project
Additional Resources
- π 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