5

I am trying to alter an RStudio Editor Themes so that I can set my own colors. I'm using RStudio version 0.99.473 on Windows 10.

I've reviewed Any way to change colors in Rstudio to something other than default options? which was extremely helpful as well as Editing R Studio them in cashe.css theme file (ACE editor?)

I am trying to identify what the different .ace_ items in the RStudio Editor Theme CSS files (ACE editor code) correspond to. The CSS files are found in /www/rstudio/ within RStudio's install path. An example of the script is found on GitHub for the Tomorrow theme.

In particular, I'm looking to see how to color variables (that I define) differently from functions. For example in x <- rnorm(10,0,10), I'd like x and rnorm to be colored differently. Not sure if that's possible.

Community
  • 1
  • 1
Jim Smith
  • 51
  • 1
  • 2

4 Answers4

5

For what it's worth, the newest versions of RStudio come with a preference that allow you to ensure that function calls are colored differently from variables -- from RStudio v1.0.44, we have the option

  • Highlight R function calls

RStudio Options

With this option active, function calls will be highlighted differently (for example, with Tomorrow Night Bright):

Image Example of Highlighting

Hopefully, user-customizable themes will become part of the next RStudio release.

Kevin Ushey
  • 20,530
  • 5
  • 56
  • 88
2

RStudio has a tutorial. Although not specific to your question about coloring variables, I did edit the highlighting of matched brackets in my theme so that they are more visible. Here's how:

Select a theme from this theme editor and save it to your machine as a .tmTheme file. Add the theme in RStudio. RStudio automatically creates an .rstheme file from that. I found the rstheme file in my Users/Eric/Documents/.R/rstudio/themes folder (Windows machine). Open the file in Notepad++ (or your favorite text editor) and find the .ace entry that matches the one you want to change (for me, specifically, .ace_bracket from the RStudio tutorial I mentioned earlier). This will have an rgba value similar to: background-color: rgba(238, 252, 81, 0.8); Note that the last value is the alpha (transparency) value and should be between 0 and 1. The values I used give me a nice bright yellow that is easily seen.

Eric Krantz
  • 1,854
  • 15
  • 25
1

I think you are looking for customising the RStudio theme and I think in that case You can check out the following link:
This website gives you several options to customize
https://tmtheme-editor.herokuapp.com/#!/editor/theme/Azure
This is how it works

click to have a look
Once you are done customizing download them. Later you can add the theme in the "add" options while setting a theme in your RStudio

Hope this was helpful
Happy Coding :)

0

I found (2022) the theme files in

C:\Users\<my user>\AppData\Roaming\RStudio\themes

Ariel
  • 19
  • 2