| Title: | Create and Install Custom 'RStudio' Themes |
|---|---|
| Description: | Create, convert and install custom 'RStudio' editor themes from 'Visual Studio Code', 'Positron' and 'TextMate' theme files. Convert themes between 'TextMate', 'Visual Studio Code' and 'Positron' formats and install bundled ports of popular themes for use in 'RStudio'. Inspect theme files as tabular data for custom conversion workflows. |
| Authors: | Diego Hernangómez [aut, cre, cph] (ORCID: <https://orcid.org/0000-0001-8457-4658>), Garrick Aden-Buie [cph] (for the rsthemes::try_rsthemes() function) |
| Maintainer: | Diego Hernangómez <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 1.2.0 |
| Built: | 2026-10-17 09:44:39 UTC |
| Source: | https://github.com/dieghernan/rstudiothemes |
Convert a .tmTheme file representing a TextMate theme and write the
equivalent Visual Studio Code or Positron theme file (.json).
convert_tm_to_positron_theme() is an alias for
convert_tm_to_vs_theme().
convert_tm_to_vs_theme( path, outfile = tempfile(fileext = ".json"), name = NULL, author = NULL ) convert_tm_to_positron_theme( path, outfile = tempfile(fileext = ".json"), name = NULL, author = NULL )convert_tm_to_vs_theme( path, outfile = tempfile(fileext = ".json"), name = NULL, author = NULL ) convert_tm_to_positron_theme( path, outfile = tempfile(fileext = ".json"), name = NULL, author = NULL )
path |
Path or URL to a TextMate theme file in |
outfile |
Path where the resulting file will be written. Defaults to
a temporary file created with |
name |
Theme name. If |
author |
Theme author. If |
A character string containing the path to the .json
theme file written to outfile.
read_tm_theme() to inspect the input theme and read_vs_theme()
to inspect the converted theme.
Theme file converters:
convert_to_rstudio_theme(),
convert_vs_to_tm_theme()
tmtheme <- system.file("ext/test.tmTheme", package = "rstudiothemes" ) path <- convert_tm_to_vs_theme(tmtheme) readLines(path) |> head(50) |> cat(sep = "\n")tmtheme <- system.file("ext/test.tmTheme", package = "rstudiothemes" ) path <- convert_tm_to_vs_theme(tmtheme) readLines(path) |> head(50) |> cat(sep = "\n")
Convert a .tmTheme or .json file that defines a TextMate or
Visual Studio Code or Positron theme and write the equivalent
RStudio theme file (.rstheme).
Optionally, the generated theme can be installed and applied to the RStudio IDE.
Important: This function only works in RStudio. It returns NULL
when called from other IDEs.
convert_to_rstudio_theme( path, outfile = tempfile(fileext = ".rstheme"), name = NULL, use_italics = TRUE, output_style = "expanded", force = FALSE, apply = FALSE )convert_to_rstudio_theme( path, outfile = tempfile(fileext = ".rstheme"), name = NULL, use_italics = TRUE, output_style = "expanded", force = FALSE, apply = FALSE )
path |
Path or URL to a TextMate theme file ( |
outfile |
Path where the resulting file will be written. Defaults to
a temporary file created with |
name |
Theme name. If |
use_italics |
Logical. Use italics in the resulting theme. Defaults to
|
output_style |
Bracketing and formatting style of the CSS output.
Possible styles: |
force |
Whether to force the operation and overwrite an existing file
with the same name. |
apply |
Logical. Apply the theme with |
RStudio supports custom editor themes in two formats, .tmTheme and
.rstheme. The .tmTheme format originated with TextMate and has become
a common theme format. This tmTheme editor hosts a large collection of
.tmTheme files. The .rstheme format is specific to RStudio.
To install a theme file, go to Tools > Global Options > Appearance > Add.
To switch themes, select one from the editor theme list under
Tools > Global Options > Appearance.
For more information, see https://docs.posit.co/ide/user/ide/guide/ui/appearance.html.
A character string containing the path to the .rstheme
file written to outfile, or NULL outside RStudio. If
force or apply is TRUE, this function also attempts to install the
theme. If apply is TRUE and installation does not raise an error, it
applies the theme to your RStudio IDE.
read_vs_theme() and read_tm_theme() to inspect input theme files.
install_rstudiothemes() to install bundled themes.
rstudioapi::addTheme() and rstudioapi::applyTheme() to install or apply
an RStudio theme directly.
Theme file converters:
convert_tm_to_vs_theme(),
convert_vs_to_tm_theme()
if (on_rstudio() && interactive()) { vstheme <- system.file("ext/skeletor-syntax-color-theme.json", package = "rstudiothemes" ) # Apply the theme for 10 seconds to demonstrate the effect. current_theme <- rstudioapi::getThemeInfo()$editor # Print the current theme name. current_theme convert_to_rstudio_theme(vstheme, name = "A testing theme", apply = TRUE, force = TRUE ) Sys.sleep(10) rstudioapi::applyTheme(current_theme) rstudioapi::removeTheme("A testing theme") }if (on_rstudio() && interactive()) { vstheme <- system.file("ext/skeletor-syntax-color-theme.json", package = "rstudiothemes" ) # Apply the theme for 10 seconds to demonstrate the effect. current_theme <- rstudioapi::getThemeInfo()$editor # Print the current theme name. current_theme convert_to_rstudio_theme(vstheme, name = "A testing theme", apply = TRUE, force = TRUE ) Sys.sleep(10) rstudioapi::applyTheme(current_theme) rstudioapi::removeTheme("A testing theme") }
Convert a .json file representing a Visual Studio Code or Positron
theme and write the equivalent TextMate theme file (.tmTheme).
convert_positron_to_tm_theme() is an alias for
convert_vs_to_tm_theme().
convert_vs_to_tm_theme( path, outfile = tempfile(fileext = ".tmTheme"), name = NULL, author = NULL ) convert_positron_to_tm_theme( path, outfile = tempfile(fileext = ".tmTheme"), name = NULL, author = NULL )convert_vs_to_tm_theme( path, outfile = tempfile(fileext = ".tmTheme"), name = NULL, author = NULL ) convert_positron_to_tm_theme( path, outfile = tempfile(fileext = ".tmTheme"), name = NULL, author = NULL )
path |
Path or URL to a Visual Studio Code or Positron theme
file in |
outfile |
Path where the resulting file will be written. Defaults to
a temporary file created with |
name |
Theme name. If |
author |
Theme author. If |
A character string containing the path to the .tmTheme
file written to outfile.
read_vs_theme() to inspect the input theme and read_tm_theme()
to inspect the converted theme.
Theme file converters:
convert_tm_to_vs_theme(),
convert_to_rstudio_theme()
vstheme <- system.file("ext/test-simple-color-theme.json", package = "rstudiothemes" ) path <- convert_vs_to_tm_theme(vstheme) readLines(path) |> head(50) |> cat(sep = "\n")vstheme <- system.file("ext/test-simple-color-theme.json", package = "rstudiothemes" ) path <- convert_vs_to_tm_theme(vstheme) readLines(path) |> head(50) |> cat(sep = "\n")
Generate version 4 universally unique identifiers (UUIDs), randomly or deterministically from a hint.
generate_uuid(hint = NULL)generate_uuid(hint = NULL)
hint |
Optional character string or object coercible with
|
This helper generates a UUID to identify generated theme versions.
A character string representing a version 4 UUID.
Adapted from an unreleased version of uuid() from
ids.
Davis KR, Peabody B and Leach P (2024). "Universally Unique Identifiers (UUIDs)." RFC 9562. doi:10.17487/RFC9562, https://www.rfc-editor.org/info/rfc9562.
Package helpers:
on_rstudio()
# Random UUID. generate_uuid() generate_uuid() # Persistent UUID with `hint`. hint <- "something as seed" generate_uuid(hint) generate_uuid(hint)# Random UUID. generate_uuid() generate_uuid() # Persistent UUID with `hint`. hint <- "something as seed" generate_uuid(hint) generate_uuid(hint)
Detect whether the current R session is running in RStudio to decide whether themes can be applied to the IDE.
on_rstudio()on_rstudio()
A logical value, TRUE if running in RStudio and
FALSE otherwise.
Package helpers:
generate_uuid()
on_rstudio()on_rstudio()
Read a .tmTheme XML file representing a TextMate or Sublime Text
theme.
read_tm_theme(path)read_tm_theme(path)
path |
Path or URL to a TextMate theme file in |
A tibble containing the theme metadata, color settings and token scopes.
convert_tm_to_vs_theme() and convert_to_rstudio_theme() to
convert TextMate themes.
Theme file readers:
read_vs_theme()
the_theme <- system.file("ext/test-color-theme.json", package = "rstudiothemes" ) |> # Convert the Visual Studio Code theme to TextMate format. convert_vs_to_tm_theme() # Check the converted theme. readLines(the_theme) |> head(10) |> cat(sep = "\n") read_tm_theme(the_theme)the_theme <- system.file("ext/test-color-theme.json", package = "rstudiothemes" ) |> # Convert the Visual Studio Code theme to TextMate format. convert_vs_to_tm_theme() # Check the converted theme. readLines(the_theme) |> head(10) |> cat(sep = "\n") read_tm_theme(the_theme)
Read a .json file representing a Visual Studio Code or Positron
theme.
read_positron_theme() is an alias for read_vs_theme().
read_vs_theme(path) read_positron_theme(path)read_vs_theme(path) read_positron_theme(path)
path |
Path or URL to a Visual Studio Code or Positron theme
file in |
A tibble containing the theme metadata, color settings and token scopes.
convert_vs_to_tm_theme() and convert_to_rstudio_theme() to
convert Visual Studio Code or Positron themes.
Theme file readers:
read_tm_theme()
vstheme <- system.file("ext/test-color-theme.json", package = "rstudiothemes" ) read_vs_theme(vstheme)vstheme <- system.file("ext/test-color-theme.json", package = "rstudiothemes" ) read_vs_theme(vstheme)
Install, list, preview or remove the RStudio themes included in rstudiothemes. These functions are adapted from selected rsthemes functions. MIT License Copyright © rsthemes authors.
Important: These functions only work in RStudio and return NULL
when called from other IDEs. The exception is
list_rstudiothemes(list_installed = FALSE).
install_rstudiothemes( style = c("all", "dark", "light"), themes = NULL, destdir = NULL ) remove_rstudiothemes(style = c("all", "dark", "light")) list_rstudiothemes(style = c("all", "dark", "light"), list_installed = TRUE) try_rstudiothemes(style = c("all", "dark", "light"), themes = NULL, delay = 0)install_rstudiothemes( style = c("all", "dark", "light"), themes = NULL, destdir = NULL ) remove_rstudiothemes(style = c("all", "dark", "light")) list_rstudiothemes(style = c("all", "dark", "light"), list_installed = TRUE) try_rstudiothemes(style = c("all", "dark", "light"), themes = NULL, delay = 0)
style |
Theme group: |
themes |
Optional character vector of theme names. If provided, only
these themes are used and |
destdir |
Optional directory for |
list_installed |
If |
delay |
Number of seconds to wait between themes. Set to 0 to be prompted to continue after each theme. |
install_rstudiothemes() and remove_rstudiothemes() are called for their
side effects. They invisibly return a character string
identifying the final cli message, or NULL if there
are no themes to install or remove. Outside RStudio, they return NULL
visibly.
list_rstudiothemes() returns a character vector of
theme names, or NULL invisibly if no bundled themes are
installed. It returns NULL visibly outside RStudio when
list_installed = TRUE.
try_rstudiothemes() is called for its side effects. It previews installed
bundled themes and restores your original theme when you quit or finish
the preview, invisibly returning a character string
identifying the final cli message. If you choose to keep a theme,
it leaves that theme active and invisibly returns NULL.
Outside RStudio, it returns NULL visibly.
install_rstudiothemes() installs bundled themes.
remove_rstudiothemes() removes bundled themes.
list_rstudiothemes() lists installed or available themes.
try_rstudiothemes() previews bundled themes.
rstudiothemes includes RStudio themes based on the following editor themes:
Andromeda Theme by Eliver Lara (MIT License).
Ayu Theme by teabyii (MIT License).
Barbie Theme by Milene Toazza (MIT License).
Bluloco Light Theme by Umut Topuzoglu (GNU Lesser General Public License version 3).
Catppuccin Theme by Catppuccin (MIT License).
Cobalt2 Theme by Wes Bos (MIT License).
CRAN Theme by dieghernan, based on the CRAN (R Project) website theme created with Pandoc (MIT License).
Dracula Theme by Dracula (MIT License).
GitHub Dark and Light Themes by GitHub (MIT License).
JellyFish Theme by Pawel Borkar (Apache License 2.0).
Matcha Theme by Luca Falasco (MIT License).
Matrix Theme by UstymUkhman (MIT License).
Night Owl Dark and Light Themes (no italics) by Sarah Drasner (MIT License).
Nord Theme by Arctic Ice Studio (MIT License).
OKSolar Theme by dieghernan (MIT License).
One Dark Pro Theme by binaryify (MIT License).
Overflow Theme by dieghernan (MIT License).
Panda Theme by Panda Theme (no license declared).
Positron Dark and Light Themes by dieghernan, inspired by the Positron IDE (MIT License).
Selenized Themes by dieghernan (MIT License).
Skeletor Syntax Theme by dieghernan (MIT License).
SynthWave '84 Theme by Robb Owen (MIT License).
Tokyo Night Theme by Enkia (MIT License).
Visual Studio Code Dark and Light Themes by Microsoft (MIT License).
Winter is Coming Theme by John Papa (MIT License).
Garrick Aden-Buie https://github.com/gadenbuie
Aden-Buie G (2026). rsthemes: Full Themes for RStudio v1.2+. rsthemes version 0.5.1, commit 48fc078f772e5e63669bc9773eabc8e9cdc7f699, https://github.com/gadenbuie/rsthemes.
convert_to_rstudio_theme() to convert and install a custom theme
file.
list_rstudiothemes(list_installed = FALSE)list_rstudiothemes(list_installed = FALSE)