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

2

7

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

Cosimo answered 13/2, 2023 at 14:9 Comment(0)
A
1

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

.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)

Antalya answered 20/3 at 15:52 Comment(0)
F
4

Building on the OP's question and the answer by @Jonathan Bar, I found the following worked for creating a theme where it is much easier to see highlighted text, including search results in RStudio (I'm using version 2024.04.1+748).

  1. Find the .rstheme file in the RStudio application package. On my Mac, it's at /Applications/RStudio.app/Contents/Resources/app/resources/themes/[theme_name].rstheme. You may have to click on "Show package contents" in the Finder to get it to show you the path.
  2. Open the .rstheme file in a text editor
  3. Look for the following line, and change the color to something you like. You can experiment with an online color picker to find a color that doesn't obscure elements of the text (this orangy color worked pretty well with the Tomorrow Night Bright theme).
.ace_marker-layer .ace_selection {
  background: #9e6450
}
  1. The first line of the theme file sets the theme name. Change it to something else. For example, change:
    /* rs-theme-name: Tomorrow Night Bright */
    to
    /* rs-theme-name: Tomorrow Night Bright modified */.
  2. Save the modified .rstheme file somewhere else (your home directory, etc.)
  3. Open RStudio, select Tools --> Global Options, then Appearance in the sidebar. Click on "Add" to add your new theme file, then "Apply" and "OK" to exit.
  4. If you need to change it again, you may want to first go back into the RStudio Tools menu, switch back to the original theme, delete yours, and then re-add your edited file.
Falkirk answered 14/6 at 23:24 Comment(1)
This is excellent!! On windows the path I needed was C:\Program Files\RStudio\resources\app\resources\themesAnal
A
1

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

.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)

Antalya answered 20/3 at 15:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.