zshzsh-completion

How to change the selected completion item color for `zsh zstyle list-colors` in .zshrc?


I'm looking to customize the selection color in zsh history and found one example.

zstyle ':completion:*' list-colors 'ma=48;2;76;86;106'

It works, and I can tinker with the numbers to make changes, but I can't find an explanation for ma=.

What is ma=?
What is the format for ma=?
Is there another approach other than ma= to adjust the color?


Solution

  • ma= sets the color for the currently selected completion. See here for more info: https://zsh.sourceforge.io/Doc/Release/Zsh-Modules.html#Colored-completion-listings

    Is there another approach other than ma= to adjust the color?

    The link above explains how to adjust them by hand. However, this can be a rather tedious task, which is why I decided to write a Zsh plugin that does it for you: Z Colors takes the value of your $LS_COLORS and generates from it

    However, if you do want to go the manual route, have a look at its source code to see how I solved this problem. It’s completely free and open source.