Coder Social home page Coder Social logo

gadenbuie / xaringanthemer Goto Github PK

View Code? Open in Web Editor NEW
446.0 11.0 28.0 17.29 MB

😎 Give your xaringan slides some style

Home Page: https://pkg.garrickadenbuie.com/xaringanthemer/

License: Other

R 76.42% CSS 23.58%
xaringan rstats themes css remarkjs slides presentation

xaringanthemer's Introduction

xaringanthemer

CRAN status xaringanthemer status badge Lifecycle: stable R-CMD-Check status badge Codecov

Give your xaringan slides some style with xaringanthemer within your slides.Rmd file without (much) CSS.

Animation previewing many xaringanthemer themes

Installation

You can install xaringanthemer from CRAN

install.packages("xaringanthemer")

or you can install the development version of xaringanthemer from GitHub.

# install.packages("remotes")
remotes::install_github("gadenbuie/xaringanthemer")

Features

There’s a lot more that xaringanthemer can do! Discover xaringanthemer’s features.

xaringanthemer's People

Contributors

apoorv74 avatar apreshill avatar friep avatar gadenbuie avatar github-actions[bot] avatar jdlom avatar pat-s avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

xaringanthemer's Issues

Read css variables from xaringan-themer.css for ggplot2 theme

Currently the ggplot2 theme feature uses env vars to retrieve key colors, which only works if the xaringanthemer style functions are called in the rendering session. Now that CSS variables are implemented, the ggplot2 theme should be able to read from xaringan-themer.css if the style functions are run separately or outside the slides Rmd.

Release xaringanthemer 0.4.0

Prepare for release:

  • Check current CRAN check results
  • Polish NEWS
  • devtools::build_readme()
  • urlchecker::url_check()
  • devtools::check(remote = TRUE, manual = TRUE)
  • devtools::check_win_devel()
  • rhub::check_for_cran()
  • revdepcheck::revdep_check(num_workers = 4)
  • Update cran-comments.md
  • Review pkgdown reference index for, e.g., missing topics
  • Draft blog post

Submit to CRAN:

  • usethis::use_version('minor')
  • devtools::submit_cran()
  • Approve email

Wait for CRAN...

  • Accepted 🎉
  • gh release create v0.4.0
  • usethis::use_dev_version()
  • Finish blog post
  • Tweet
  • Add link to blog post in pkgdown news menu

column theme .pull-right and .pull-left not working

With css: xaringan-themer.css in the header, .pull-right and .pull-left don't work to divide a slide into two columns.

 sessionInfo("xaringanthemer")
R version 3.3.0 (2016-05-03)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                           LC_TIME=English_United States.1252    

attached base packages:
character(0)

other attached packages:
[1] xaringanthemer_0.1.1

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.16    rstudioapi_0.7  servr_0.9       knitr_1.20      magrittr_1.5    devtools_1.13.5 grDevices_3.3.0
 [8] xtable_1.8-2    R6_2.2.2        stringr_1.3.0   httr_1.3.1      highr_0.6       tools_3.3.0     utils_3.3.0    
[15] DT_0.4.4        xfun_0.1        xaringan_0.6.4  git2r_0.21.0    withr_2.1.2     crosstalk_1.0.0 htmltools_0.3.6
[22] stats_3.3.0     datasets_3.3.0  yaml_2.1.18     leaflet_2.0.0   digest_0.6.15   rprojroot_1.3-2 base_3.3.0     
[29] shiny_1.0.5     later_0.7.1     promises_1.0.1  htmlwidgets_1.2 graphics_3.3.0  rsconnect_0.8.8 curl_3.2       
[36] mime_0.5        memoise_1.1.0   evaluate_0.10.1 rmarkdown_1.9   stringi_1.1.7   methods_3.3.0   backports_1.1.2
[43] jsonlite_1.5    httpuv_1.4.1

Add use_showtext argument to theme_xaringan

I currently have text_font_use_google and header_font_use_google, but it would probably be helpful to have a use_showtext argument that can be toggled off or even set with a global option, or if possible that inherits from knitr::opts_chunk$get("fig.showtext").

Related to #30

Change default fonts

So far, I've tried to keep the themes so that the "start from" the default xaringan theme and can be customized away.

But Droid Serif isn't officially part of Google Fonts anymore and causes problems with sysfonts::font_add_google(). I think the default fonts look interesting but are terrible for legibility in presentations to large audiences.

I like the Source Sans Family or Noto Sans Family. Both have wide support at many weights, languages and have corresponding serif and code fonts.

Weird clash with xaringanthemer and custom graphics fonts in Rmd

Hi there, I have been having a graphics font issue that initially arose in a non-xaringan context, but I've nonetheless traced the cause back to something with xaringanthemer. I don't know much about the specifics, but I can describe what I know and provide a MWE that shows the problem at least on my machine (MacOS Catalina). Here's what I know:

  • An Rmarkdown project that I'm working on uses ggplot graphics with custom fonts. Ever since upgrading to R 4.0 (maybe relevant?), those fonts stopped appearing in compiled Rmd documents. Fonts would still work in interactive R sessions and if I saved graphics from an interactive session using ggsave().
  • Compiled Rmd documents would print this warning around these failed graphics: ## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font ## family 'Source Sans Pro' not found, will use 'sans' instead. (This happens with any font, not just Source Sans Pro.)
  • After some debugging, I realized the issue was arising because I was calling xaringanthemer::lighten_color(). I never fully attached the package, only called a function from it. If I delete any reference to xaringanthemer, all fonts in the compiled Rmd work correctly.

I created a minimal Rmd that reproduces the problem on my machine found here. Something diagnostically interesting is the fact that the problem doesn't arise in the same chunk where xaringanthemer is invoked, even if I create a graphic after invoking the package. The problem only arises in subsequent chunks, which the MWE highlights. This feels consistent w/ the finding that interactive sessions still work without a hitch for me.

Although I came across this problem in a non-Xaringan Rmd document, Xaringan slideshows have the same issue for me as well.
I'm concerned this is something idiosyncratic about my machine or font library or R package library (and might have causes that are deeper down than xaringanthemer itself), since customizing fonts to be consistent w/ a Xaringan theme seems like a pretty common for users of this package to want to do, and I'm not finding any info elsewhere about people having similar problems as me. If that's the case, I'm sorry to bug you about it, and maybe I just need to reconfigure my R setup from scratch or something. Thanks for the help and for such a cool package!

Release xaringanthemer 0.3.1

Prepare for release:

  • devtools::build_readme()
  • Check current CRAN check results
  • devtools::check(remote = TRUE, manual = TRUE)
  • devtools::check_win_devel()
  • rhub::check_for_cran()
  • revdepcheck::revdep_check(num_workers = 4)
  • urlchecker::url_check()
  • Update cran-comments.md
  • Polish NEWS

Submit to CRAN:

  • usethis::use_version('patch')
  • devtools::submit_cran()
  • Approve email

Wait for CRAN...

  • Accepted 🎉
  • usethis::use_github_release()
  • usethis::use_dev_version()

Add `text_bold_font_weight` argument

I'm not sure this is a bug, I'm doing something wrong, or Firefox is not rendering content properly.
I am following the example in the website documentation using style_mono_accent().

style_mono_accent( 
  base_color = "#262626", #1c5253
  header_font_google = google_font("Josefin Sans"),
  text_font_google   = google_font("Montserrat", 
                                   "300", "700", "300i")

Generates this .css

body {
  font-family: var(--text-font-family), var(--text-font-family-fallback), var(--text-font-base);
  font-weight: 300;
  color: var(--text-color);
}

This displays properly on the Rstudio viewer, but not on Firefox. The strong tag is overwritten by font-weight: 300 in body.
The only way I found to have this display properly in Firefox is by adding "inherit" at the beginning of the weights on google_font()

style_mono_accent( 
  base_color = "#262626", #1c5253
  header_font_google = google_font("Josefin Sans"),
  text_font_google   = google_font("Montserrat", "inherit", 
                                   "300", "700", "300i")

Generates this .css

body {
  font-family: var(--text-font-family), var(--text-font-family-fallback), var(--text-font-base);
  font-weight: inherit;
  color: var(--text-color);
}

Support autoformatting of ggrepel functions

Hello,

I was wondering how much hassle it would be to include support for the ggrepel functions? Obviously we can manually do this with something like:

  update_geom_defaults("text_repel",
                       list(family = "desired font", color = "desired color"))

and similar for label_repel. But if theme_xaringan() could do it for us that would be nice. I guess it shouldn't be too tricky to add a ggrepel = TRUE argument into theme_xaringan(), and whack in an if statement - but if it could automatically pick up any geoms that are text or label and then set those accordingly, that might be quite a convenient solution (for the user). Assuming there's no extension packages around that have those in their geom names - which could make this more hassle than it's worth! Here's an MWE of what I mean:

---
title: "Example"
output: html_document
---
knitr::opts_chunk$set(echo = TRUE)
library(ggplot2)
library(tidyverse)
library(xaringanthemer)
style_mono_accent(
  base_color = "#DC322F",               # bright red
  inverse_background_color = "#002B36", # dark dark blue
  inverse_header_color = "#31b09e",     # light aqua green
  inverse_text_color = "#FFFFFF",       # white
  title_slide_background_color = "var(--base)",
  text_font_google = google_font("Kelly Slab"),
  header_font_google = google_font("Oleo Script")
)
data <- tibble( 
  label = LETTERS[1:5],
  x = 1:5,
  y = (1:5)^2
)

p_text <- data %>%
  ggplot(aes(x = x, y = y, label = label)) +
  geom_text() +
  theme_xaringan()
p_text

image

library(ggrepel)

p_repel <- data %>%
  ggplot(aes(x = x, y = y, label = label)) +
  geom_text_repel() +
  theme_xaringan()
p_repel

image

No highlighting of R code input and output

I would like to remove any highlighting of R code input and output from slides.
I tried to set code_highlight_color but with no effect.
How can this be obtained using xaringanthemer?

Inconsistent behaviour when plotting with ggplot2 and emojis and xaringanthemer is being used

I have been observing that when I have emojis in my plots that I make with ggplot2 and include in a xaringan presentation, sometimes when I knit the emojis show up and other times they don't. I believe the culprit might be xaringanthemer as adding/removing the chunk where a theme is defined with xaringanthemer seems to affect the outcome.

Here is my minimal xaringan document


---
title: "xaringan document with emoji ggplot2"
output:
  xaringan::moon_reader:
    css: xaringan-themer.css
    lib_dir: libs
    nature:
      highlightStyle: github
      highlightLines: true
      countIncrementalSlides: false
---

```{r xaringan-themer, include = FALSE}
library(xaringanthemer)
style_duo_accent(
  primary_color = "blue",
  secondary_color = "white",
)
```

```{r dev = "ragg_png"}
suppressPackageStartupMessages(library(ggplot2))

ggplot(mtcars, aes(x = mpg, y = disp)) +
  geom_text(label = "🚗")
```

Here are the steps to reproduce the issue:

  • Restart session
  • Run xaringan::inf_mr() -> Emojis don't work in the viewer, or when popped out to the browser
  • Run xaringan::inf_mr() again -> Emojis work in the viewer and when popped out to the browser
  • Restart session
  • Click Knit -> Emojis don't work in the viewer, or when popped out to the browser
  • Click Knit again -> Emojis don't work in the viewer, or when popped out to the browser
  • Run xaringan::inf_mr() -> Emojis don't work in the viewer, or when popped out to the browser
  • Run xaringan::inf_mr() again -> Emojis work in the viewer and when popped out to the browser
  • Remove the chunk labeled xaringan-themer, butleave the css parameter in the YAML (so it uses the previously generated CSS file)
  • Restart session
  • Run xaringan::inf_mr() -> Emojis work in the viewer and when popped out to the browser
  • Restart session
  • Click Knit again -> Emojis work in the viewer and when popped out to the browser
  • Put the chunk labeled xaringan-themer back in, and we're back to the beginning

cc @thomasp85

Generate matching ggplot2 themes

Let theme functions take a ggplot2 theme object, applies theme colors to key plot elements and sets default theme with theme_set(). Also updates geom defaults.

Secondarily, the theme prep function can be exported as well so that users can separately construct the theme in case they don't want to set the global ggplot2 theme.

A function to tweak minor detail of other themes

Currently, xaringanthemer writes a complete version of the default xaringan theme, but it occurred to me that, now that there are more user-contributed themes available, users may want to modify or tweak a small portion of another theme. For example, a user may want to use the metropolis theme but change font sizes or colors.

I could provide a function, e.g. modify_theme(), that writes inline CSS into the slide deck to modify small aspects of the remark theme. For example, changing the header font size might be done with

```{r echo=FALSE}
xaringanthemer::modify_theme(header_h1_font_size = "24px")
```

<style>
.remark-slide-content h1 {
  font-size: 24px;
}
</style>

Technically speaking this may be easier to do now that I rewrote the template in mustache.

If you're interesting in this feature, an thumbs up on this issue will be very motivating! 😉

Font not imported when deployed on Github pages

Hi and thank you for this nice package.

I am working on a presentation: http://www.pmassicotte.com/greenedge2019/

I want to use Roboto font in my slide. Based on the documentation, I did this:

library(xaringanthemer)
duo(
  code_font_family = "Fira Code",
  code_font_url    = "https://cdn.rawgit.com/tonsky/FiraCode/1.204/distr/fira_code.css",
  text_font_google = google_font("Roboto", "400", "400i", "600i", "700")
)

This works fine locally on my computer. However, the Roboto font do not show when deployed on Github page (see the link above).

Any ideas?

Guard against uninstalled packages in rmarkdown template

Light and Dark Mode

Leaving this note for myself for a half baked idea that you could prob beat me to executing but let the user add a little button to the top right of their slides so the viewer can toggle between light and dark mode which would invert their color palettes (and obviously with a cute little sun icon to toggle to light and moon for dark)

Use CSS custom properties and variables

If I replace the current CSS template with a version of the default.css from xaringan updated to use CSS variables (with fallback values), then all xaringanthemer has to do is write out the :root element.

In fact, the updated default.css could even be pushed upstream to xaringan, which would make general tweaking of xaringan colors easier for users, and would also make maintenance easier in the long run.

Be more strict on what "extra_fonts" arg accepts

Help page

A list of additional fonts to import, each list element can be either a URL as a character string or a call to google_font()

However, other font arguments such as "text_font_google" and friends accept a single font only (which makes sense).
Though if one specifies a single font only for "extra_fonts", not

@import url(https://fonts.googleapis.com/css?family=Crimson+Text);

is parsed into the resulting CSS but only

@import url(Crimson Text);

The latter results in the font not being available.

Suggestion: Either support only a list for extra_fonts or also support single google_font() calls.

(I know these are the ugly details of a package that comes with functions that have so many args... 😄 )

Adding logos to slides

Some options:

  1. add the logo to the default slide class,
  2. use an approach similar to #10,
  3. or create a .logo class that the user can manually add to desired slides

The last option could actually just be a helper function style_add_logo_class() that could be called separately from style_() functions.

Theme function writes CSS content twice

When calling

duo_accent_inverse(
  primary_color = "white",
  secondary_color = "#272822",
  title_slide_background_color = "white",
  title_slide_text_color = "black",
  outfile = here::here("assets/css/xaringan.css"),
  header_font_google = google_font("Josefin Sans"),
  text_font_google = google_font("Montserrat", "500", "400i"),
  code_font_google = google_font("Droid Mono"),
  link_color = "#eb1455",
  text_bold_color = "#00589a",
  text_font_size = "25px",
  header_color = "#002733",
  padding = "1em 2em 1em 2em",
  background_color = "white",
  text_color = "black", 
  extra_fonts = list(google_font("Crimson Text"),
                     google_font("IBM Plex Mono")) 
)

with the current dev version, I get the whole CSS duplicated (in a new session, even when deleting the file beforehand). This causes problems with some fonts:

Some are only loaded in the second block and finally not honored in the HTML later on (e.g. IBM Plex Mono).

I've put the file into a gist so you can have a direct look at it.

Document or automate fig.showtext = TRUE

It might be strictly required that users include

```{r xaringan-themer, include = FALSE}
knitr::opts_chunk$set(fig.showtext = TRUE)
# ... style_* function()
```

for the font matching features of theme_xaringan() to work. If so, this needs to be prominently documented.

Alternatively, if it can be worked around and set automatically, that would be even better.

Release xaringanthemer 0.3.0

Chores:

  • Update existing documentation
  • Fonts vignette/article
  • Enable CI/CD testing and pkgdown site
  • Update xaringanthemer skeleton starter doc
  • Update readme to include CRAN install instructions
  • Add link to homepage in pkgdown docs
  • Ensure new features are completely documented
  • Document new usage of CSS variables (new vignette?)
  • Update autocomplete gif
  • New starter template that better demos themed elements
  • social media image for twitter

Prepare for release:

  • Update NEWS
  • Check that description is informative
  • Check licensing of included files
  • usethis::use_cran_comments()
  • devtools::check()
  • devtools::check_win_devel()
  • rhub::check_for_cran()
  • Polish pkgdown reference index
  • Draft blog post

Submit to CRAN:

  • usethis::use_version('minor')
  • Update cran-comments.md
  • devtools::submit_cran()
  • Approve email

Wait for CRAN...

  • Accepted 🎉
  • usethis::use_github_release()
  • usethis::use_dev_version()
  • Update install instructions in README
  • Finish blog post
  • Tweet
  • Add link to blog post in pkgdown news menu

Installation Error

Hi,

I was trying to download the package but I got the below error.
Error: Failed to install 'xaringanthemer' from GitHub:
(converted from warning) installation of package ‘C:/Users/Nastaba/AppData/Local/Temp/RtmpU14CUW/file766451c75541/xaringanthemer_0.2.0.tar.gz’ had non-zero exit status

Header font fallback in style_xaringan

Hi Garrick,

Should there be a header_font_family_fallback parameter in style_xaringan() similar to text_font_family_fallback and code_font_family_fallback? Or does it just default to using the fallback defined for text?

Better highlight and document CSS-free customizations

From recent Twitter discussions, a clear strength of this package is the ability to adjust slide styles without using CSS. Secondarily, discoverability is also important -- knowing where to look to find out what you can change is important.

Current documentation focuses on discoverability and assumes some familiarity with CSS. Some improvements:

  • Better highlight that pkg accommodates easy CSS-free changes
  • Add section or table of parameters (or table in docs, vignettes) with parameter and CSS-level (no CSS required, low CSS, intermediate, high, etc.)
  • Make sure documentation gives an idea about what kinds of CSS params are expected in each function args, bonus points for examples

Unable to knit the template 'Ninja Themed Presentation'

Hi Garrick!

This happened sometimes and I'm not sure if is reproducible.

When I create a .Rmd with the template 'Ninja Themed Presentation' and just knit right away (without changing it, which is good to be 'renderable' for people that are being introduced to the package), RMarkdown returns an error:

Error in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : polygon edge not found

image

It says that the 'problem' is with line 308. So if I comment the code for xaringanthemer::theme_xaringan() in this chunk, the file renders fine:

```{r plot-example-themed, eval=requireNamespace("ggplot2", quietly=TRUE)}
 g + #xaringanthemer::theme_xaringan(text_font_size = 16, title_font_size = 18) +
 ggtitle("A Plot About Cars")
```

I tested and seems like I can't use xaringanthemer::theme_xaringan() and that's why the template does not work on the fly.

Do you know if this is happening to more people? I'm not sure if I should install something different in order for it to work.

These are my system information, I'm using an m1:

> Sys.info()
                                                                                                sysname 
                                                                                               "Darwin" 
                                                                                                release 
                                                                                               "20.5.0" 
                                                                                                version 
"Darwin Kernel Version 20.5.0: Sat May  8 05:10:31 PDT 2021; root:xnu-7195.121.3~9/RELEASE_ARM64_T8101" 
                                                                                               nodename 
                                                                         "MacBook-Air-de-Beatriz.local" 
                                                                                                machine 
                                                                                               "x86_64" 
                                                                                                  login 
                                                                                                 "root" 
                                                                                                   user 
                                                                                          "beatrizmilz" 
                                                                                         effective_user 
                                                                                          "beatrizmilz" 

Thank you :)

Insert Images as background

I was wondering if there is a way to use images (.jpg, .png) as background for a slide?

I've looked through the code, but couldn't find a function to do that. I remmeber trying to do that with the xaringan package, I succeded but it was a bit tedious to do so....

Issue installing 0.2.0 from github

Hi,

I'm getting an error when I try installing from github. Here's the installation output in a clean Rstudio session (running ubuntu 18.04)

> devtools::install_github("gadenbuie/xaringanthemer")
Downloading GitHub repo gadenbuie/xaringanthemer@master
✓  checking for file ‘/tmp/Rtmp3tVsn2/remotes275a2d6f0f6f/gadenbuie-xaringanthemer-460f441/DESCRIPTION’ ...
─  preparing ‘xaringanthemer’:
✓  checking DESCRIPTION meta-information ...
─  checking for LF line-endings in source and make files and shell scripts
─  checking for empty or unneeded directories
─  building ‘xaringanthemer_0.2.0.tar.gz’
   
Installing package into ‘/home/starkie/R/x86_64-pc-linux-gnu-library/3.6’
(as ‘lib’ is unspecified)
* installing *source* package ‘xaringanthemer’ ...
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
Error : Assigned data `vars[var]` must be compatible with existing data.
ℹ Error occurred for column `default`.
x No common type for `value` <character> and `x` <list>.
Error: unable to load R code in package ‘xaringanthemer’
Execution halted
ERROR: lazy loading failed for package ‘xaringanthemer’
* removing ‘/home/starkie/R/x86_64-pc-linux-gnu-library/3.6/xaringanthemer’
Error: Failed to install 'xaringanthemer' from GitHub:
  (converted from warning) installation of package ‘/tmp/Rtmp3tVsn2/file275a12fa6648/xaringanthemer_0.2.0.tar.gz’ had non-zero exit status

My session info:

> sessionInfo()
R version 3.6.1 (2019-07-05)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.3 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1

Random number generation:
 RNG:     Mersenne-Twister 
 Normal:  Inversion 
 Sample:  Rounding 
 
locale:
 [1] LC_CTYPE=en_AU.UTF-8       LC_NUMERIC=C               LC_TIME=en_AU.UTF-8        LC_COLLATE=en_AU.UTF-8    
 [5] LC_MONETARY=en_AU.UTF-8    LC_MESSAGES=en_AU.UTF-8    LC_PAPER=en_AU.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_AU.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.3        rstudioapi_0.10   magrittr_1.5      usethis_1.5.1     devtools_2.2.1    pkgload_1.0.2    
 [7] R6_2.4.1          rlang_0.4.5       fansi_0.4.1       tools_3.6.1       pkgbuild_1.0.6    sessioninfo_1.1.1
[13] cli_2.0.2         withr_2.1.2       ellipsis_0.3.0    remotes_2.1.0     assertthat_0.2.1  digest_0.6.25    
[19] rprojroot_1.3-2   crayon_1.3.4      processx_3.4.1    callr_3.4.1       fs_1.3.1          ps_1.3.0         
[25] curl_4.3          testthat_2.3.1    memoise_1.1.0     glue_1.3.2        compiler_3.6.1    desc_1.2.0       
[31] backports_1.1.5   prettyunits_1.1.1

I've previously installed an used it on a number of platforms. Any idea what could be stopping it this time?

If not I can fork it and see what I find.

Title Area Border Color

I want to qualify that I am very new and am only now finding the time to start to wrap my head around xaringan and the ability to write my lecture slide decks in R Markdown. Also, I have very little experience editing CSS. 😄

That said, I love where you are going with this package and have more of a feature request really. One of the things that I like about the metropolis theme is the shaded title area. This would let me stay on brand for my institution.

Is it possible to add that as a modifiable attribute in your theme functions and customization? From the theme (and color modified by me), it appears that this is the area of the CSS that drives that.

.remark-slide-content {
  background-color: #FAFAFA;
  border-top: 80px solid #CC0000;
  font-size: 20px;
  font-weight: 300;
  line-height: 1.5;
  padding: 1em 2em 1em 2em
}

I dont know if it would be possible to have two additional arguments for the theme; border-top and border-color, something like that?

Thanks again for this awesome package. It appears that there is much to be excited about in future releases!

Inline code background color should only apply to inline code in <p> tags

Currently code_inline_background_color applies background-color to the .remark-inline-code class.

But this class is added to any <code> elements that are not children of <pre>, so changing all background colors seems like too much.

Personally, I would rather the default is applied only to children of <p>, or in other words only to inline code inside regular text. I'm on the fence about list elements.

p .remark-inline-code {
  background-color: {{code_inline_background_color}};
}

Documentation for arg background_position in `write_xaringan_theme` not clear

Can you please clarify in (write_xaringan_theme.rd)[man/write_xaringan_theme.rd] how to specify argument background_position? background-position in theme.css can take two values (%) per argument to specify vertical and horizontal position.

However, when I specify:
r write_xaringan_theme(background-position = c(0,100))
xaringan_themer.css returns with
r background-position: 0;

I am not sure what the solution is, otherwise I would submit a PR.

extra_css classes no longer affect font size of output

Hello!

I used to be able to customize output font sizes by adding a custom class and then using it to adjust the font size of my (text) results so they'd fit on a slide. Here's my xaringan-themer block:

style_mono_light( 
  base_color = "#00539B",
  background_color = "#FFFFFF",
  code_font_size = ".8rem",
  extra_css = list("li" = list("padding" = "8px 0px 0px"),
                   ".small" = list("font-size" = "60%"))
  )

So if I, for example, wrapped a Rmd code block containing (say) summary(fit) in .small[] it would make the output smaller. Now for the life of me I can't get that to work. I've tried a lot (many hours) to figure this out but I'm stumped. I even reverted my remarkjs chakra to 0.14.0 hoping that that would work but it didn't. Any help would be greatly appreciate!

Remove names from color vectors before modifying

library(xaringanthemer)

palette <- c(
  primary = "#1381B0",  # Blue
  secondary = "#FF961C" # Yellow/orange
)

style_duo_accent(
  outfile = NULL,
  primary_color = palette["primary"],
  secondary_color = palette["secondary"],
  inverse_header_color = "#FFFFFF"
)
#> Error: Color names in `colors` must be valid CSS classes

happens because primary.primary and secondary.secondary are names in the color vector and fails checks that they'll be valid CSS.

ignoring xaringan-themer.css

A small question about best practice: would you recommend adding xaringan-themer.css to .gitignore for a repo that uses the package? Ordinarily, I'd commit something like this to make it easily nabbable by other users, but it seems like the package effectively makes this a temp file.

And a note of praise: I think this package may have solved a persistent thorn in my side. I've never been able to figure out a way to: a) maintain a css that I can easily access across documents in different directories/repos while b) making any .Rmd that I hand off to someone else able to access the same css without needing an additional package. My solution was to create a package for personal use containing Rmd templates that include in their first r setup chunk source an external r script.

---
title: ""
subtitle: ""
author: "Andrew Bray"
output:
  xaringan::moon_reader:
    css: xaringan-themer.css
    lib_dir: libs
    nature:
      highlightStyle: atelier-forest-light
      highlightLines: true
      highlightSpans: true
      countIncrementalSlides: false
---

```{r setup, include=FALSE}
source("https://raw.githubusercontent.com/andrewpbray/stitched/master/demos/slides_css.R")

Although it's a bit wonky, I decided to put the css-generating script in the /demos directory:

xaringanthemer::style_mono_accent(
  base_color = "#1c5253",
  header_font_google = xaringanthemer::google_font("Josefin Sans"),
  text_font_google   = xaringanthemer::google_font("Montserrat", "300", "300i"),
  code_font_google   = xaringanthemer::google_font("Fira Mono")
)

There may well be a better structure for solving this problem, but I wasn't able to crack it until this package came along - thanks!

`inverse_header_color` should inherit `inverse_text_color`

And there might be other places where choose_dark_or_light() was called multiple times in a family of arguments where it could only be called once.

, "inverse_text_color", "#d6d6d6", ".inverse", "Inverse Text Color", "--inverse-text-color"
, "inverse_text_shadow", "{FALSE}", ".inverse", "Enables Shadow on text of inverse slides", NA_character_
, "inverse_header_color", "#f3f3f3", ".inverse h1, .inverse h2, .inverse h3", "Inverse Header Color", "--inverse-header-color"

Remove references to iris

Remove reference(s) to iris from the following files.

References

#' ggplot(iris) +

#' ggplot(iris) +

#' plot1 <- ggplot(iris) +

#' plot2 <- ggplot(iris) +

knitr::kable(head(iris), format = 'html')

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.