Skip to content

Commit cc68e9a

Browse files
use bslib to load brand.yml files
1 parent e653786 commit cc68e9a

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

DESCRIPTION

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ URL: https://github.com/quarto-dev/quarto-r,
1717
BugReports: https://github.com/quarto-dev/quarto-r/issues
1818
Depends:
1919
R (>= 3.6)
20-
Imports:
20+
Imports:
21+
bslib,
2122
cli,
2223
jsonlite,
2324
later,

R/theme.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ theme_colors_flextable <- function(bg, fg) {
2828
#'
2929
#' @export
3030
theme_brand_flextable <- function(brand_yml) {
31-
brand <- yaml::yaml.load_file(brand_yml)
31+
brand <- attr(bslib::bs_theme(brand=brand_yml), "brand")
3232
theme_colors_flextable(brand$color$background, brand$color$foreground)
3333
}
3434

@@ -62,7 +62,7 @@ theme_colors_ggplot <- function(bg, fg) {
6262
#'
6363
#' @export
6464
theme_brand_ggplot <- function(brand_yml) {
65-
brand <- yaml::yaml.load_file(brand_yml)
65+
brand <- attr(bslib::bs_theme(brand=brand_yml), "brand")
6666
theme_colors_ggplot(brand$color$background, brand$color$foreground)
6767
}
6868

@@ -84,7 +84,7 @@ theme_colors_gt <- function(bg, fg) {
8484
#'
8585
#' @export
8686
theme_brand_gt <- function(brand_yml) {
87-
brand <- yaml::yaml.load_file(brand_yml)
87+
brand <- attr(bslib::bs_theme(brand=brand_yml), "brand")
8888
theme_colors_gt(brand$color$background, brand$color$foreground)
8989
}
9090

@@ -106,7 +106,7 @@ theme_colors_plotly <- function(bg, fg) {
106106
#'
107107
#' @export
108108
theme_brand_plotly <- function(brand_yml) {
109-
brand <- yaml::yaml.load_file(brand_yml)
109+
brand <- attr(bslib::bs_theme(brand=brand_yml), "brand")
110110
theme_colors_plotly(brand$color$background, brand$color$foreground)
111111
}
112112

@@ -127,6 +127,6 @@ theme_colors_thematic <- function(bg, fg) {
127127
#'
128128
#' @export
129129
theme_brand_thematic <- function(brand_yml) {
130-
brand <- yaml::yaml.load_file(brand_yml)
130+
brand <- attr(bslib::bs_theme(brand=brand_yml), "brand")
131131
theme_colors_thematic(brand$color$background, brand$color$foreground)
132132
}

0 commit comments

Comments
 (0)