Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Download and/or convert theme as appropriate #120

Merged
merged 3 commits into from Dec 11, 2018

Conversation

jmcphers
Copy link
Member

This is a small change motivated by theme installation instructions beginning to appear in the wild, e.g.:

https://github.com/gadenbuie/yule-rstudio

https://github.com/batpigandme/night-owlish

Ideally the "install and apply my theme" code snippet featured in these repos would be a single line of R code. This change makes that possible by adding some logic to the addTheme API wrapper:

  1. If the theme path given looks like a URL, it's downloaded first.
  2. If the theme path given looks like a .tmtheme, it's converted first.

After the change, you can download, install, and apply a theme in a single step:

rstudioapi::addTheme("https://raw.githubusercontent.com/gadenbuie/yule-rstudio/master/Yule-RStudio.rstheme", apply = TRUE)

Copy link
Contributor

@MariaSemple MariaSemple left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

R/themes.R Outdated
# If the path appears to be a URL, download it.
if (grepl("^https?:", themePath)) {
# Give the downloaded filename the same name and extension as the original.
parts <- strsplit(themePath, "/", fixed = TRUE)[[1]]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: I think basename() would still work fine for URLs.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call.

@jmcphers jmcphers merged commit 0510be7 into master Dec 11, 2018
@MariaSemple MariaSemple deleted the feature/smart-add-theme branch January 21, 2022 19:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants