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

Closed
exsesx opened this issue Jan 10, 2025 · 3 comments · Fixed by jesseduffield/gocui#73 or #4242
Closed

Unreadable Foreground Text in Search Results #4162

exsesx opened this issue Jan 10, 2025 · 3 comments · Fixed by jesseduffield/gocui#73 or #4242

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

@GitMurf
Copy link

GitMurf commented Feb 9, 2025

@stefanhaller thank you so much! I have been searching high and low trying to figure out how to change this and just thought it was a skill issue 🤣

There are a few areas like this where I have wondered whether there was a color variable to set in config. I am unclear whether I know all the available color variables or not. Is it accurate to say the best spot to find all available color variables is in the default config under theme: from here (https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#default)? or is there a better / more exhaustive list? Thanks much!!

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