themesrstudio

Is it possible to change the highlight or background color of the "search results" from the help menu in RStudio?


I'm able to change the colour of selected text in the RStudio script window. For this I changed the

.ace_marker-layer .ace_selection {
  background: #9D0000; 
}

in the /Applications/RStudio.app/Contents/Resources/app/resources/themes/chaos.rstheme

But whenever I do a search in the 'Help' panel, the highlighted background is a faint grey and would like to change it. Where could I find the value that needs to be changed for this?

The reason is that it is super hard to see the highlighted background in the help and a colour change would make it much easier to search in the help menu!

enter image description here


Solution

  • While editing your .rstheme file, Append the following lines to the end of the file.

    For RStudio version 2024.09.0 and above:

    .rstudio-themes-flat.rstudio-themes-dark.editor_dark.ace_editor_theme ::selection {
        background: rgba(179, 101, 57, 0.75) !important;
        color: orange !important;
    }
    

    For an older RStudio version, you should use this code snippet:

    .rstudio-themes-dark.editor_dark.ace_editor_theme ::selection {
        background: rgba(179, 101, 57, 0.75) !important;
        color: inherit !important;
    }
    

    If that does not work,

    1. duplicate your .rstheme file, and rename the first row with a unique identifier, like so:

      /* rs-theme-name: Cobalt (SELECTHELP) */

    2. Append the previous lines to the end of the file.

    3. In RStudio, go to Tools > Global Options > Appearance

    4. Click "Add..."

    5. Select the previously edited file

    Of course, you can change the color to match your preferred theme... I use Cobalt, as any reasonable person would do :)

    Before & After image: Before (Left), After (Right)