如何从 bslib 主题中提取字体?

问题描述 投票:0回答:1

我想从

bslib
创建的主题中提取不同的字体。有一个名为
bs_get_variables
的函数,但我似乎没有返回任何
font-familes

vars <- c("body-bg", "body-color", "primary", "border-radius", "font-family", "base_font", "code_font", "heading_font")
bs_get_variables(bs_theme(bootswatch = "sketchy"), varnames = vars)
r shiny bslib
1个回答
0
投票

请参阅文档https://rstudio.github.io/bslib/articles/bs5-variables/index.html

library(bslib)
vars <- c("body-bg", "body-color", "primary", "border-radius", "font-family-sans-serif", "font-family-monospace", "font-family-base", "headings-font-family", "font-family-code")
bs_get_variables(bs_theme(bootswatch = "sketchy"), varnames = vars)

给予:

                                                                                                            body-bg 
                                                                                                             "#fff" 
                                                                                                         body-color 
                                                                                                          "#212529" 
                                                                                                            primary 
                                                                                                             "#333" 
                                                                                                      border-radius 
                                                                                                             "25px" 
                                                                                             font-family-sans-serif 
"Neucha, -apple-system, system-ui, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif" 
                                                                                              font-family-monospace 
                         "SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace" 
                                                                                                   font-family-base 
                                                                                        "var(--bs-font-sans-serif)" 
                                                                                               headings-font-family 
                                                                                        "\"Cabin Sketch\", cursive" 
                                                                                                   font-family-code 
                                                                                         "var(--bs-font-monospace)" 
© www.soinside.com 2019 - 2024. All rights reserved.