https://github.com/marlonrichert/zcolors
🌈 Use your $LS_COLORS to generate a coherent theme for Git & your Zsh prompt, command line and completions.
https://github.com/marlonrichert/zcolors
color completion configuration git lscolors prompt shell terminal theme theming zsh zsh-theme
Last synced: 4 months ago
JSON representation
🌈 Use your $LS_COLORS to generate a coherent theme for Git & your Zsh prompt, command line and completions.
- Host: GitHub
- URL: https://github.com/marlonrichert/zcolors
- Owner: marlonrichert
- License: mit
- Created: 2020-09-23T12:50:46.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2025-04-22T05:44:27.000Z (7 months ago)
- Last Synced: 2025-06-02T18:00:05.402Z (6 months ago)
- Topics: color, completion, configuration, git, lscolors, prompt, shell, terminal, theme, theming, zsh, zsh-theme
- Language: Shell
- Homepage:
- Size: 642 KB
- Stars: 82
- Watchers: 3
- Forks: 4
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-zsh-plugins - zcolors - Uses your `$LS_COLORS` to generate a coherent theme for Git and your Zsh prompt, completions and [ZSH syntax highlighting](https://github.com/zsh-users/zsh-syntax-highlighting). (Plugins / ZSH on Windows)
- fucking-awesome-zsh-plugins - zcolors - Uses your `$LS_COLORS` to generate a coherent theme for Git and your Zsh prompt, completions and <b><code> 21885⭐</code></b> <b><code> 1360🍴</code></b> [ZSH syntax highlighting](https://github.com/zsh-users/zsh-syntax-highlighting)). (Plugins / ZSH on Windows)
README
# 🌈 Z Colors
Use your Gnu `$LS_COLORS` to generate a coherent theme for `git`, `less`, `grep`, and your Zsh
prompt, completions and syntax highlighting. Don't know how to or don't feel like customizing your colors?
No worries: Z Colors comes with an excellent default theme, too.
Once you've [installed](#installation) Z Colors, then your theme is automatically applied to `git`,
`less`, `grep`, and Zsh completions and [syntax highlighting](#requirements). No other steps are
required. (For using Z Colors in your prompt, [see below](#prompt-colors).)
> Do you enjoy using this software? Then please consider to [become a
> sponsor](https://github.com/sponsors/marlonrichert). 💝
## Requirements
If you use `$LS_COLORS`, then the values for `di`, `ln`, `so`, `pi`, `ex`, `bd`, `cd`, `su`, `sg`,
`tw` and `ow` need to contain 3- or 4-bit colors only. 8- and 24-bit colors are currently _not_
supported!
Completion highlighting requires Zsh's ["new" completion
system](https://zsh.sourceforge.io/Doc/Release/Completion-System.html).
Syntax highlighting requires
[`zsh-syntax-highlighting`](https://github.com/zsh-users/zsh-syntax-highlighting).
## Installation
1. Open a terminal.
1. Run:
```sh
cd ~/Repos # or wherever you keep your Git repos/Zsh plugins
git clone https://github.com/marlonrichert/zcolors.git
```
1. Complete the steps for [customizing your theme](#customizing-your-theme).
1. Add to your `~/.zshrc` file:
```sh
source ~/Repos/zcolors/zcolors.plugin.zsh
source ${$XDG_CACHE_HOME:=~/.cache}/zcolors
```
Then start a new terminal or shell to enjoy your theme.
## Customizing your theme
Whenever you want make changes to your theme, do the following:
1. In your terminal, set `$LS_COLORS` to your desired value.
1. Run:
```sh
autoload -Uz ~/Repos/zcolors/functions/zcolors
zcolors ${(q+)LS_COLORS} >| ${$XDG_CACHE_HOME:=~/.cache}/zcolors
```
Then start a new terminal or shell to enjoy your new theme.
## Updating
1. Open a terminal and run `git -C ~/Repos/zcolors pull`.
1. Complete the steps for [customizing your theme](#customizing-your-theme).
# Prompt colors
For adding colors to your prompt, Z Colors provides an associative array `$zcolor` containing the
theme values for file types `di`, `ln`, `so`, `pi`, `ex`, `bd`, `cd`, `su`, `sg`, `tw` and `ow`.
Here's an example of how to use it:
```sh
# $'...': string with support for `print` escape codes
# %{%}: Tell the prompt that is zero-width output.
# %{\e[m%}: Reset all colors and other highlighting.
# %~: present working dir
# %#: `%` for normal user, `#` for root
PS1=$'%{\e['$zcolor[di]$'m%}%~%{\e[m%}/ %# '
```