Search code examples
rrstudio

Exporting default RStudio themes, or setting parenthesis colour?


I'm trying to customise my RStudio theme, which is easy enough using https://tmtheme-editor.glitch.me/

One of the default themes is so nearly perfect for my particular colourblindness and all I want to do is tweak the contrast a bit, but it doesn't exist in the gallery in the editor (yes, I'm sure), and I can't find a way to set the parentheses to have a distinct colour. This is definitely possible and RStudio definitely supports it, because Material [nb, not the same as this Material theme], one of their default themes does this and it's incredibly useful:

Screenshot of RStudio's theme-picker showing the theme 'Material' which has red parentheses:

enter image description here

However, the various guides I can find for making R themes don't include this as an option.

I've been trying to export this theme from RStudio so I can upload it and just tweak the colours, or edit the CSS direcrly, but I can't find a way to do that. User-installed themes can be found in the config files as described here, but not the themes that came with RStudio in the first place

Any ideas?


Solution

  • You will find the file you want in RStudio/resources/themes/material.rstheme. In particular, line 138 shows

    .ace_paren.ace_keyword.ace_operator {
      color: #cc6666 !important;
    }
    

    This gives us a CSS hook to change the color of parentheses in an RStudio theme. We can change it to yellow, for example:

    .ace_paren.ace_keyword.ace_operator {
      color: #ffff30 !important;
    }
    

    Which looks like this:

    enter image description here