Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Any way to change colors in Rstudio to something other than default options?

Tags:

rstudio

Is there anyway to change the color schemes for Rstudio? It comes with 6 or 7 default, pre-packaged themes. I'm wondering if theres anyway for me to customize these or some add-in that lets me make my own.

like image 516
runningbirds Avatar asked Aug 30 '14 12:08

runningbirds


People also ask

How do I change colors in RStudio?

In the menu bar, open the “Tools” menu. From the drop down menu, choose “Global Options”. In the pane on the left hand side of the options window, click “Appearance”. To import a theme, click on the “Add…” button.

How do you add color to RStudio?

In R, colors can be specified either by name (e.g col = “red”) or as a hexadecimal RGB triplet (such as col = “#FFCC00”). You can also use other color systems such as ones taken from the RColorBrewer package.


3 Answers

There's a much faster way to deal with this and 100% doable.

  1. Open RStudio with your favourite Editor theme and open an .R script

  2. Inspect the Source layout (Right-click>Inspect) and Ctrl + f an unique class selector such as .ace_comment. In the matched CSS rules box in the side pane copy an attribute as unique as possible (i.e. color: #0088FF; I use Cobalt theme).

  3. Go to RStudio's install path and dive into /www/rstudio/. As jorloff rightly said, you'll find a bunch of files like this: VERYUGLYNAME.cache.css. Open all of them with your favourite text editor as administrator.

  4. Find in files: Ctrl+ Shift + f (in sublime text) and type the unique attribute value you previously chosed. BOOM, there you have it.

  5. Now delight yourself editing your crazy style, but remember to back it up first!

As Jonathan said, RStudio's editor is based on ACE themes, so all clases have the ace_ prefix. Take your time inspecting and understanding the editor hierarchy. I recommend you to take some time inspecting the html code to understand its structure. The editor starts in id="rstudio_source_text_editor"

I'm using RStudio Desktop 0.99.892 Release for Windows

like image 180
Carlos Araya Avatar answered Sep 27 '22 22:09

Carlos Araya


Unfortunately there's not currently a way to do this. RStudio's themes are based on themes for the ACE text editor, which it embeds. It can generate internal themes based on ACE themes, so if you have an ACE theme you'd really like to use with RStudio, you can submit a pull request to RStudio (which is hosted on GitHub) for consideration.

like image 37
Jonathan Avatar answered Sep 27 '22 22:09

Jonathan


i am new to R Studio and i would like to share how i was able to customize the color scheme of R Studio:

How to change the color of comments in Rstudio

  1. Rstudio Pane Appearance > Set editor theme to monokai
  2. Right click on editor pane > Inspect > find the specific file name (i.e. 838C7F60FB885BB7E5EED7F698E453B9.cache.css)
  3. Open drive C > open Progam Files folder > open Rstudio folder
  4. Open www folder > rstudio folder > find the 838C7F60FB885BB7E5EED7F698E453B9.cache.css (name of the theme you want to change)
  5. Make a backup copy of the original
  6. Change .ace_comment {color: #75715E} to .ace_comment {color: #F92672} > save to another location (don't change file name)
  7. Copy the recently saved code and paste it in rstudio folder (step 4) > replace the original 838C7F60FB885BB7E5EED7F698E453B9.cache.css file with the modified 838C7F60FB885BB7E5EED7F698E453B9.cache.csss file
  8. Click continue
  9. Quit Rstudio
  10. Open Rstudio
  11. Check if the color of comment has changed from nightsand(#75715E) to orchid(#F92672)
like image 22
palangga Avatar answered Sep 27 '22 21:09

palangga