I have been spending a lot of time coding in RStudio lately, and the default white background is starting to cause significant eye strain. I’ve looked through the basic settings but I can't seem to find the specific menu for editor themes. Is there a way to switch to a dark mode or even import custom CSS themes into RStudio? I really want to change the background to something like Cobalt or Dracula to make the syntax highlighting pop more while working on my data visualization projects.
3 answers
Changing the background color in RStudio is actually quite simple once you know where the preference pane is hidden. You need to navigate to Tools > Global Options from the top menu. Once the window opens, click on the Appearance tab on the left-hand side. There, you will see a dropdown menu labeled "Editor theme." You can cycle through several pre-installed dark and light themes like "Tomorrow Night Blue" or "Monokai." Selecting one will instantly update the preview window so you can see the background color and syntax highlighting before applying it. If you want even more options, you can click the "Add" button to import .rstheme files you've downloaded from the community.
Are you specifically looking to change just the editor pane's background, or are you trying to apply a "Global Dark Mode" that affects the console, environment pane, and file browser as well?
You should definitely try the "Chaos" or "Vibrant Ink" themes. They have high contrast which is excellent for long coding sessions and really helps with data science debugging.
I agree with Alice. "Chaos" is my daily driver. It makes the different colors for functions and strings stand out much better than the default "Textmate" theme does.
That is an important distinction, Ryan. If you select a dark theme under the Appearance tab, RStudio generally applies it to the entire IDE. However, in older versions, some UI elements stayed light. If Daniel is on the latest version of RStudio, choosing a theme like "Dracula" will automatically switch the entire interface to dark mode. If he wants a custom color that isn't in the list, he'd have to use a custom CSS theme file, which requires a bit more technical setup in the RStudio configuration folder.