Skip to content

Commit

Permalink
preserve theme class (#5823)
Browse files Browse the repository at this point in the history
  • Loading branch information
teunbrand committed Apr 3, 2024
1 parent e8b62f6 commit 1050f09
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions R/theme.R
Original file line number Diff line number Diff line change
Expand Up @@ -576,8 +576,9 @@ plot_theme <- function(x, default = theme_get()) {
# Check that all elements have the correct class (element_text, unit, etc)
validate_theme(theme)


theme[intersect(names(theme), names(get_element_tree()))]
# Remove elements that are not registered
theme[setdiff(names(theme), names(get_element_tree()))] <- NULL
theme
}

#' Modify properties of an element in a theme object
Expand Down

0 comments on commit 1050f09

Please sign in to comment.