You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If cli::code_highlight() is called in RStudio with an unrecognized theme (i.e. a non-builtin theme), it signals a warning and doesn't highlight the code:
cli::code_highlight("1 + 1")
#> [1] "1 + 1"#> Warning message:#> In code_theme_default_rstudio() :#> cli does not know this RStudio theme: a11y-dark {rsthemes}
This can be avoided by setting options("cli.code_theme"). Here's an example for the theme "base16 Gruvbox dark, soft {rsthemes}":
Ah this would be super cool but it's a lot harder than it looks. rsthemes helps build the .rstheme CSS file used by RStudio, using scss stylesheets. Older versions of themes, like all the base16 themes, were made in pure scss. Newer themes are built via rstheme() but the process is similar: rstheme() orchestrates scss variables and stylesheets.
All this to say, rsthemes doesn't have a reliable source of data for the colors used in a theme other than the .rstheme stylesheet. So we'd have to go parse that to figure out the colors. But this stylesheet is equally available to the RStudio IDE... so in short I think that https://github.com/rstudio/rstudio is probably in a better position to provide this feature.
I'm going to keep it open though in case any ideas occur to me.
If
cli::code_highlight()
is called in RStudio with an unrecognized theme (i.e. a non-builtin theme), it signals a warning and doesn't highlight the code:This can be avoided by setting
options("cli.code_theme")
. Here's an example for the theme "base16 Gruvbox dark, soft {rsthemes}":Is it possible to use data from
rsthemes
to setoptions("cli.code_theme")
when callinguse_theme_*()
?The text was updated successfully, but these errors were encountered: