Skip to content

Commit 5ed3c92

Browse files
committed
Add theme_white
Which is intended to give an aspect similar to theme_grey but with a white background.
1 parent 22b606f commit 5ed3c92

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

R/theme-defaults.r

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,27 @@ theme_bw <- function(base_size = 12, base_family = "") {
8383
)
8484
}
8585

86+
#' A theme with white background.
87+
#'
88+
#' @param base_size base font size
89+
#' @param base_family base font family
90+
#' @export
91+
theme_white <- function(base_size = 12, base_family = "") {
92+
# Starts with theme_grey and then modify some parts
93+
theme_grey(base_size = base_size, base_family = base_family) %+replace%
94+
theme(
95+
axis.ticks = element_line(colour = "grey50", size=0.25),
96+
legend.key = element_rect(fill="white", colour = "grey50", size=0.25),
97+
panel.background = element_rect(fill = "white", colour = NA),
98+
panel.border = element_rect(fill = NA, colour = "grey50", size=0.5),
99+
panel.grid.major = element_line(colour = "grey80", size=0.25),
100+
panel.grid.minor = element_line(colour = "grey92", size = 0.125),
101+
strip.background = element_rect(fill = "grey50", colour = NA),
102+
strip.text.x = element_text(colour = "white"),
103+
strip.text.y = element_text(colour = "white", angle = -90)
104+
)
105+
}
106+
86107
#' A minimalistic theme with no background annotations.
87108
#'
88109
#' @param base_size base font size

0 commit comments

Comments
 (0)