Skip to content

Commit 863cb95

Browse files
authored
only replace when actually present (#6448)
1 parent 2bce668 commit 863cb95

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

R/theme.R

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -560,13 +560,14 @@ validate_theme_palettes <- function(elements) {
560560
}
561561

562562
# Standardise spelling
563-
elements <- replace_null(
564-
elements,
565-
palette.colour.discrete = elements$palette.color.discrete,
566-
palette.colour.continuous = elements$palette.color.continuous
567-
)
568-
elements$palette.color.discrete <- NULL
569-
elements$palette.color.continuous <- NULL
563+
if ("palette.color.continuous" %in% names(elements)) {
564+
elements["palette.colour.continuous"] <- elements["palette.color.continuous"]
565+
elements[["palette.color.continuous"]] <- NULL
566+
}
567+
if ("palette.color.discrete" %in% names(elements)) {
568+
elements["palette.colour.discrete"] <- elements["palette.color.discrete"]
569+
elements[["palette.color.discrete"]] <- NULL
570+
}
570571

571572
# Check for incompatible options
572573
pals <- c("palette.colour.discrete", "palette.colour.continuous",

0 commit comments

Comments
 (0)