fzf icon indicating copy to clipboard operation
fzf copied to clipboard

[FEATURE] Highlighted substring background color

Open jackpipe opened this issue 2 years ago • 10 comments

  • [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

Please add a background color to the 'highlighted substrings' options hl and hl+, eg hl_bg, hl_bg+

  • OS
    • [x] Linux
    • [x] Mac OS X
    • [ ] Windows
    • [ ] Etc.
  • Shell
    • [x] bash
    • [x] zsh
    • [ ] fish

jackpipe avatar Nov 02 '22 03:11 jackpipe

Tagging along because it seemed related and possibly better than opening a new issue.

Please consider adding theme variables for the query text (foreground and background). Something like query-fg and query-bg, perhaps, based on the naming conventions for the existing variables.

Use case: working on a quiet/minimal fzf theme and would like to disambiguate query text from candidate list:

image

pete-debiase avatar Nov 02 '22 21:11 pete-debiase

@pete-debiase You might want to check out https://github.com/junegunn/fzf/issues/3029.

junegunn avatar Nov 03 '22 00:11 junegunn

For now, you can try using reverse attribute.

fzf --color hl:red:reverse,hl+:bright-red:reverse

junegunn avatar Nov 03 '22 06:11 junegunn

When someone is modifying the code for this, can you guys please add an option to have "even line" and "uneven line" background colors? Thanks

hugoeustaquio avatar Nov 08 '22 12:11 hugoeustaquio

@hugoeustaquio

add an option to have "even line" and "uneven line" background colors

Could you clarify what you mean by this? Different (alternating) background colors for even and odd lines in the candidate list? Similar to what GitHub does with Markdown tables, for example?

pete-debiase avatar Nov 08 '22 12:11 pete-debiase

@junegunn Checked out #3029, I dig it :) .

I think I may be looking for "state disambiguation" (active text versus inactive text) rather than "spatial disambiguation" (text above the line versus text below the line) for my use case.

I would love to take a shot at implementing this if you'd be open to a PR. I have a few other things to get done first, but I will check back in to see if the coast is clear before looking into it any further :) .

pete-debiase avatar Nov 08 '22 12:11 pete-debiase

@pete-debiase In the imagem below, you can see a printscreen of rofi, showing even lines having one background color, and uneven lines having another, creating a "zebra" effect on the list. image

I use fzf like rofi, on a floating terminal, that option wold be eye candy.

hugoeustaquio avatar Nov 08 '22 13:11 hugoeustaquio

@pete-debiase

Something like query-fg

We already have it.

fzf --color query:bright-yellow
fzf --color query:bright-yellow:reverse

junegunn avatar Nov 09 '22 00:11 junegunn

Surprised/embarrassed to find out I was on fzf 0.20.0 instead of the latest 0.34.0. Apparently they have me on an ancient version of Ubuntu on this confounded Windows/WSL work machine - I miss my comfy Manjaro home.

Apologies for being a bonehead. Thanks for pointing me in the right direction :) .

pete-debiase avatar Nov 09 '22 13:11 pete-debiase

@pete-debiase

Something like query-fg

We already have it.

fzf --color query:bright-yellow
fzf --color query:bright-yellow:reverse

This works fine some cases, for a dark background and a light highlight, and vice versa. But it does not work in my case, black text and a solarized-light background (off-white), and then highlighter-pen type highlights, eg cyan, lime green, pink, yellow, violet, etc. as in this contrived example:

image .

jackpipe avatar Nov 13 '22 15:11 jackpipe