Skip to content

Latest commit

 

History

History
92 lines (71 loc) · 2.24 KB

File metadata and controls

92 lines (71 loc) · 2.24 KB

{css2r}

Lifecycle: stable R-CMD-check

Installation

You can install the development version of {css2r} like so:

remotes::install_github("ThinkR-open/css2r")

Extract CSS properties from a webpage

library(css2r)

thinkr <- css2r$new(url = "https://thinkr.fr")
#> ✔ Internet ok
#> ✔ html page downloaded
#> ✔ CSS links extracted
#> ✔ CSS links filtered
#> ✔ CSS downloaded
#> ✔ Colors extracted successfully
#> ✔ Colors analyzed successfully.
#> ℹ No Google Fonts detected.
#> ✔ Shiny theme code generated.

Extract CSS files

thinkr$domain_css_links
#> [1] "https://thinkr.fr/wp-content/plugins/contact-form-7/includes/css/styles.css?ver=bb2d787e235e363bcd946916dcbe3a3e"
#> [2] "https://thinkr.fr/wp-content/themes/thinkr/build/styles.min.css?ver=d8388fa78d03fb082703981d36577b70"            
#> [3] "https://thinkr.fr/wp-content/plugins/ics-calendar/assets/style.min.css?ver=c4c312147315328d9608fa93e291ea72"

Extract top colors

thinkr$top_colors
#> $white_black
#>      Color Count
#> 32 #FFFFFF     1
#> 
#> $top_colors
#>     Color Count
#> 1 #38404C   133
#> 2 #0046C8    72
#> 3 #F05622    40
#> 4 #20B8D6    23

Show shiny theme

cat(thinkr$shiny_code)
#> fluidPage(
#>   theme = bslib::bs_theme(
#>     bg = "#FFFFFF",
#>     fg = "#38404C",
#>     primary = "#38404C",
#>     secondary = "#0046C8"
#>   ),
#>   h1("Hello World primary", class = "text-center text-secondary"),
#>   h1("Hello World secondary", class = "text-center text-primary")
#> )

Run the application

You can launch the application by running:

css2r::run_app()

Code of Conduct

Please note that the css2r project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.