Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change zsh-autosuggestions color

People also ask

How do I update my zsh plugins?

Usage. Add autoupdate to the plugins=() list in your ~/. zshrc file and you're done. The updates will be executed automatically as soon as the oh-my-zsh updater is started.

How do I use autocomplete in zsh?

zsh-autocomplete adds real-time type-ahead autocompletion to Zsh. Find as you type, then press Tab to insert the top completion, Shift Tab to insert the bottom one, or ↓ / PgDn to select another completion.

How do I change my oh my zsh theme?

You can browse all the “Oh My ZSH” Themes here. To change the Theme, simply change the ZSH_THEME value in ~/. zshrc file from robbyrussell to Avit.


You can edit your ~/.zshrc and change/add the variable: ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=value'

I have just tested the value from fg=8 to fg=5. I think fg stands for Foreground.

ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=5'

**OBS: Add the above line at the end of your zshrc (after loading the plugin) **

I found another reference here.


Here is a list of the color numbers: https://coderwall.com/p/pb1uzq/z-shell-colors

I settled on this one for solarized dark:

ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=60'

...and this one for solarized light:

ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=180'

I keep these in separate files (which do other color-theme manipulations) so that whenever somebody turns the lights on or off, I can just source the appropriate file, restart my terminal, and carry on.

My solution requires a little manual editing to make work, but you might find it interesting: https://github.com/MatrixManAtYrService/colorshift


To add to SergioAraujo's useful answer, the ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=<value>' setting follows the xterm-256-color convention. So you can actually choose a value for fg from a standard xterm 256 color chart (such as the one found here) rather then playing the guessing game.