Created
October 5, 2017 09:27
-
-
Save romainfrancois/c1c8b6d474c04d07104f543bb3c4ca5b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(css) | |
library(glue) | |
library(rvest) | |
library(stringr) | |
library(dplyr) | |
library(purrr) | |
directory <- "https://github.com/rstudio/rstudio/blob/master/src/gwt/src/org/rstudio/studio/client/workbench/views/source/editors/text/themes" | |
raw_directory <- "https://raw.githubusercontent.com/rstudio/rstudio/master/src/gwt/src/org/rstudio/studio/client/workbench/views/source/editors/text/themes" | |
rstudio_theme_names <- read_html(directory) %>% | |
html_nodes("a[title$='css']") %>% | |
html_text() %>% | |
str_replace( "[.]css$", "") | |
rstudio_themes <- map_df( rstudio_theme_names, ~{ | |
theme <- . | |
read_css(glue("{raw_directory}/{theme}.css")) %>% | |
mutate( theme = theme ) | |
}) | |
darkness <- rstudio_themes %>% | |
filter( str_detect(rule, "ace_editor_theme"), property == "background-color" ) %>% | |
mutate(dark = colMeans(col2rgb(value)) < 128 ) %>% | |
select( theme, dark ) | |
rstudio_themes <- left_join(rstudio_themes, darkness, by = "theme") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment