Skip to content

Commit

Permalink
fix: warning when metadata colors are a list instead of a vector
Browse files Browse the repository at this point in the history
  • Loading branch information
aviezerl committed Apr 14, 2024
1 parent 85a61fe commit 5cd5a94
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion R/metadata.R
Original file line number Diff line number Diff line change
Expand Up @@ -569,13 +569,14 @@ parse_metadata_colors <- function(metadata_colors, metadata) {
))
}
} else {
if (is.list(.x) && all(names(.x) == c("colors", "categories"))) {
if (is.list(.x) && length(names(.x)) == 2 && all(names(.x) == c("colors", "categories"))) {
res <- .x$colors
names(res) <- .x$categories
} else {
if (is.null(names(.x))) {
cli_abort("In metadata colors field {.field {.y}}, color vector doesn't have any names.")
}

res <- .x
}
return(res)
Expand Down

0 comments on commit 5cd5a94

Please sign in to comment.