So, I was trying to configure my custom zsh theme. I wanted something minimal like displaying the current user, a shortened path and the git info of a directory (if there is).
After a few hours of tinkering, I pretty much got what I wanted but the only thing I didn't like was the colors available.
I wasn't sure which file to look for that contains the
I did try doing a ripgrep:
rg fg_bold hoping that I would find a list of available colors. But all I found were
.zsh-theme files that were using a fixed set of colors. Magenta, green, blue, yellow, cyan were the ones I found.
I wasn't satisfied with the colors available and I did some trial and error by doing
$fg[pink], etc. But I had no luck.
I did some google search about defining custom colors in zsh and it led me to this GitHub issue: https://github.com/ohmyzsh/ohmyzsh/issues/1101#issuecomment-5450278
It seems that oh-my-zsh uses
Spectrum under the hood. The source code can be found under
Upon checking the source code, I tried running
spectrum_ls on my terminal and I was amazed by the output :asto
I can now use custom colors on my custom zsh theme via
So, that's it! I just wanted to share how I managed to define custom colors in my zsh setup.
I made a minimal version of the theme I was working on for those who might be interested: https://github.com/yujinyuz/dotfiles/blob/master/zsh/themes/jpro-minimal.zsh-theme
You can check out the documentation on adding themes to oh-my-zsh: https://github.com/ohmyzsh/ohmyzsh/wiki/Customization#overriding-and-adding-themes
Thanks for reading! It was a great experience writing my first article here on dev.to after being a member for about 2 years now 😅