Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unreadable Foreground Text in Search Results #4162

Open
exsesx opened this issue Jan 10, 2025 · 2 comments
Open

Unreadable Foreground Text in Search Results #4162

exsesx opened this issue Jan 10, 2025 · 2 comments

Comments

@exsesx
Copy link

exsesx commented Jan 10, 2025

Topic
When searching (e.g., for "merge") in Lazygit’s git log view, the search result highlights change the background but not the foreground text color. This leads to poor contrast, making the text unreadable.

Your thoughts

  • Adjust foreground text dynamically for better contrast in search results.
  • Add a config option to customize both foreground and background for search highlights.

Request
Is there an existing config setting to fix this? If not, could this be added?

Screenshot
See attached.

Thanks for the great tool! Any help is appreciated.

image
@stefanhaller
Copy link
Collaborator

Request
Is there an existing config setting to fix this?

No, there's no config setting for this. Actually, there isn't one for the background color either, it is currently hardcoded to Cyan for the selected result and Yellow for all others.

I suppose it would already be an improvement to simply set the foreground color to black, without adding config options for any of these. The patch for this would be as simple as this:

diff --git a/vendor/github.com/jesseduffield/gocui/view.go b/vendor/github.com/jesseduffield/gocui/view.go
index 0a54c51c1..d7c35e3f5 100644
--- a/vendor/github.com/jesseduffield/gocui/view.go
+++ b/vendor/github.com/jesseduffield/gocui/view.go
@@ -523,6 +523,7 @@ func (v *View) setRune(x, y int, ch rune, fgColor, bgColor Attribute) {
 	}
 
 	if matched, selected := v.isPatternMatchedRune(x, y); matched {
+		fgColor = ColorBlack
 		if selected {
 			bgColor = ColorCyan
 		} else {

@jesseduffield What do you think?

@jesseduffield
Copy link
Owner

Sounds good to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants