Fzf: Option to set background of highlights

Created on 24 Nov 2019  路  4Comments  路  Source: junegunn/fzf

  • [x] I have read through the manual page (man fzf)
  • [x] I have the latest version of fzf
  • [x] I have searched through the existing issues

Info

  • OS

    • [x] Linux

    • [ ] Mac OS X

    • [ ] Windows

    • [ ] Etc.

  • Shell

    • [ ] bash

    • [x] zsh

    • [ ] fish

Problem / Steps to reproduce

That would be great if I could set the background of highlights, not just their foreground. I'm experimenting with colorful (--ansi) inputs and I found that there is no good setting for hl.

All 4 comments

Hi @zsugabubus, isn't this more of a feature request for highlight or the program you use for previewing things?

UPDATE: Actually, in version 0.20.0, there is an option to set a colour to the background:

fzf --preview 'cat {}' \
    --color 'fg:#bbccdd,fg+:#ddeeff,bg:#334455,preview-bg:#223344,border:#778899' \
    --border --height 20 --layout reverse --info inline

From: https://github.com/junegunn/fzf/blob/master/CHANGELOG.md

Thanks for the feedback. I鈥檓 talking about highlightings of searched substrings. You can set their foreground using hl or hl+ but as I said, sometimes it would be more suitable if you could set their background (too). I usually match fancy colored lines, so these highlights get lost in the rainbow. I could achieve greater contrast with this option.

Still no color option for background, but since 0.24.0, you can set reverse attribute which might suit your needs.

# Apply reverse attribute
rg --line-number --no-heading --color=always "" |
  fzf --ansi --color hl:reverse,hl+:reverse

# -1 means keeping the original foreground color
rg --line-number --no-heading --color=always "" |
  fzf --ansi --color hl:reverse:-1,hl+:reverse:-1

Thanks a lot, looks great!

(Though the issue is not _exactly_ about it I'm satisfied with the result, so you can close it if you would like to.)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lbeier picture lbeier  路  3Comments

jan-warchol picture jan-warchol  路  3Comments

firedev picture firedev  路  3Comments

ahmedelgabri picture ahmedelgabri  路  3Comments

sassanh picture sassanh  路  3Comments