Tools to generate a coherent theme git, less, grep, and your Zsh
prompt, completions and syntax highlighting
Also includes convienences for working with ANSI colors in general.
Do you enjoy using this software? Then please consider to become a sponsor. π
- For completion highlighting: Zsh's "new" completion system.
- For command line highlighting:
zsh-syntax-highlighting.
To install, simply clone the repo:
git clone https://github.com/marlonrichert/zcolors.git
Z Colors' main usage is to generate a theme:
-
cdinto the repo. -
To generate the default theme, run:
zcolors > ~/zshthemeAlternatively, to generate a custom theme based on your GNU
$LS_COLORS, run:zcolors "$LS_COLORS" > ~/zsh_themeβ οΈ Note:- Your
$LS_COLORSvalues fordi,ln,so,pi,ex,bd,cd,su,sg,twandowneed to contain 3- or 4-bit colors only. 8- and 24-bit colors are currently not supported! zcolorswill generate BSD$LSCOLORSfor you, but you cannot pass it as input!
- Your
-
Add to your
.zshrcfile:source zshtheme -
Close your current shell and open a new one.
Repeat these steps whenever you want to update your theme.
Additionally to configuring your theme, doing the above also exposes the following array and functions.
An associative array that contains your theme values for file types di, ln, so, pi, ex,
bd, cd, su, sg, tw and ow.
Example:
# $'...': 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%}/ %# 'Converts a $color entry to ANSI and prints it.
Example usage:
color dim
print 'This text is now dim'
color nonePrints the ANSI highlighting for a particular file type.
Example usage:
print 'The current directory is '
lscolor di
print $PWD
color none-
cdinto the repo and rungit pull. -
Repeat the steps under Usage.
See the LICENSE file for more details.