2.1 Dark Theme
https://rstudio.github.io/rstudio-extensions/rstudio-theme-creation.html
https://docs.posit.co/ide/user/ide/guide/ui/appearance.html#creating-custom-themes-for-rstudio
Theme repositories
rstudiothemes
: https://github.com/max-alletsee/rstudio-themesrsthemes
: https://www.garrickadenbuie.com/project/rsthemes/
RStudio and Editor themes are two differnt things
RStudio theme applies to the IDE’s framework; including Modern (default), Classic, Sky, and Dark.
The Sky theme is similar to the Modern theme, except for the tab and toolbar headers. 淡淡的蓝色
The dark theme is a superset to the Modern and Sky themes that is activated whenever the Editor theme uses a dark palette.
Editor theme applies to the source pane.
A useful tool to customize your editor theme: https://tmtheme-editor.glitch.me/#!/editor/theme/Monokai
Embeded themes can be found here: https://github.com/rstudio/rstudio/tree/87e129853121106a87e92df416363f39da95f82e/src/cpp/session/resources/themes
Useful elements:
.ace_marker-layer .ace_selection
Changes the color and style of the highlighting for the currently selected line or block of lines.
.ace_marker-layer .ace_bracket
Changes the color and style of the highlighting on matching brackets.
Recommended highlight color: rgba(255, 0, 0, 0.47)
If you really like one of the default themes RStudio provides, but you want to tweak some small things, you can go the theme directory and change the element’s appearance.
RStudio
’s default editor theme directory on Mac:
Right click RStudio.app
, “Show Package Contents” to navigate to the application folder.
/Applications/RStudio.app/Contents/Resources/resources/themes/ambiance.rstheme
(deprecated)
New editor theme directory: /Applications/RStudio.app/Contents/Resources/app/resources/themes/ambiance.rstheme
You may also find the default themes on GitHub repo: https://github.com/rstudio/rstudio/tree/master/src/cpp/session/resources/themes
If you want to install or create a completely new theme, use the Custom theme (user-defined) folder:
~/.config/rstudio/themes/idle_fingers_2.rstheme
on mac- viridis-theme
/* yaml tag */
.ace_meta.ace_tag {
color: #2499DA;
}
/* quoted by $...$ and code chunk options */
.ace_support.ace_function {
color: #55C667;
}
See HERE for common selectors you can use.
A collection of screenshots of default RStudio themes: https://www.trifields.jp/list-of-rstudio-editor-themes-2520
Q: The margin line is too bright.
A: Change the .ace_print-margin
element.
#e8e8e8
is the culprit here, and should be darkened. I changed it to #2F3941
.
Source: https://github.com/rstudio/rstudio/issues/3420#issuecomment-453154475
Install custom themes
Using
rstudiothemes
pkgGo to the repository to see which theme you want to use. Then install the theme. Themes can be applied to RStudio via “Tools” - “Global Options” - “Appearance” - “Add Theme”.
# install the pseudo-package from this Github repository devtools::install_github("max-alletsee/rstudio-themes") library(rstudiothemes) # ... then load the library # example 1: bulk-install all light themes install_rstudio_themes(theme = "all_light") # example 2: install two specific light themes install_rstudio_themes(theme = c("Ayu Light", "Github {rsthemes}")) # examplease 3: install one specific dark theme install_rstudio_themes(theme = "49th Parallel")
Using
rstudioapi
package’s “addTheme” function# create temporary download directory theme_49th_parallel <- fs::path_temp("49th_parallel-RStudio", ext = "rstheme") # download theme from github download.file("https://raw.githubusercontent.com/wvictor14/rstudio_themes/master/49th%20Parallel.rstheme", theme_49th_parallel) # apply the theme rstudioapi::addTheme(theme_49th_parallel, apply = TRUE)