Skip to content

🌈 Use your $LS_COLORS to generate a coherent theme for Git & your Zsh prompt, command line and completions.

License

Notifications You must be signed in to change notification settings

marlonrichert/zcolors

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

90 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌈 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 Z Colors, then your theme is automatically applied to git, less, grep, and Zsh completions and syntax highlighting. No other steps are required. (For using Z Colors in your prompt, see below.)

Do you enjoy using this software? Then please consider to become a sponsor. πŸ’

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.

Syntax highlighting requires zsh-syntax-highlighting.

Installation

  1. Open a terminal.

  2. Run:

    cd ~/Repos  # or wherever you keep your Git repos/Zsh plugins
    git clone https://github.com/marlonrichert/zcolors.git
  3. Complete the steps for customizing your theme.

  4. Add to your ~/.zshrc file:

    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.

  2. Run:

    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.
  2. Complete the steps for 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:

# $'...': string with support for `print` escape codes
# %{<esc>%}: Tell the prompt that <esc> 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%}/ %# '

About

🌈 Use your $LS_COLORS to generate a coherent theme for Git & your Zsh prompt, command line and completions.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Sponsor this project

 

Languages