How to change colour of file in "find in files"?

I have had no luck finding which colour setting controls the file name listed in the "find in files" search results. The default of light grey on white is pretty much invisible.

0
7 comments

It depends on your theme and the type of search. Please share your screenshot. My example:

0

I think the theme and type of search change what it looks like - but i doubt they impact where the setting is.

0

but i am looking for setting to change this:

0

Hi Peter,
If the file name in the next line is identical to the one in the previous line, we make it semi-transparent. Unfortunately, there is no setting to control this. We apologize for the inconvenience. 

0

Ah, I see. That makes sense. I didn't realize the first was a different colour as I can barely see that one either. Is it possible to change the first one?

0

This color is used in many places in the IDE. Unfortunately, it's impossible to configure the color only in the "Search everywhere". If you are OK with making many UI elements black and contrasting, try creating a custom theme plugin with the following settings:

```

{
"name": "theme_basics",
"author": "JetBrains Support",
"dark": false,
"editorScheme": "/theme_basics.xml",
"ui": {
"Component.infoForeground": "#000000"
}
}
}

Plugin example to download:

https://uploads.jetbrains.com/files/2023_08_23_djWdT8M5eC8pDeUd3rfC9Z_JBS/ThemeTest.jar?secret=4Uyk677Xnn3kJL5wstAVDJdh5nn4xCaF

0

I choose to build IDEA from source. fighting with colors and size..

here is my result:

the primary color is set to yellow , and the secondary is set to shallow blue,  make it easier to distinguish between different file names.

( the first visible row will always have yellow file name! )

source code including : FindPopupPanel.java,NamedColorUtil.java

The key is to modify com/intellij/find/impl/FindPopupPanel.java 

like so : 

```

private final ColoredTableCellRenderer myFileAndLineNumber = …
  protected void customizeCellRenderer ..

            String fileString = presentation.getFileString();
           String prevFileString = findPrevFile(table, row, column);
           boolean sameFile = Objects.equals(fileString, prevFileString);
           
           if(sameFile) { 
             // tint first row visible
             JViewport viewport = (JViewport) table.getParent();
             Rectangle viewRect = viewport.getViewRect();
             int scrollY = viewRect.y;
             point0.y = scrollY;
             int fvp = table.rowAtPoint(point0);
             if(fvp>=0) {
               if(fvp==row) sameFile = false;
               if(row-1==fvp) {
                 int rh = table.getRowHeight(row-1);
                 if(scrollY%rh>rh/2)
                   sameFile = false; // tint
               }
             }
           }
           SimpleTextAttributes attributes = sameFile ? REPEATED_FILE_ATTRIBUTES : ORDINAL_ATTRIBUTES;
           append(StringUtil.trimMiddle(fileString, 60), attributes);
           if (text.length > 0) append(" " + text[0].getText(), ORDINAL_ATTRIBUTES);

```

 

0

Please sign in to leave a comment.