diff --git a/R/sg_palette.R b/R/sg_palette.R index dccf8ea..3dc10ef 100644 --- a/R/sg_palette.R +++ b/R/sg_palette.R @@ -39,22 +39,22 @@ sg_palette <- function(palette = "main", ext_palettes <- subset( names(palette_list), - stringr::str_detect(names(palette_list), "^main[5-9]") + stringr::str_detect(names(palette_list), "^main([5-9]|-extended)") ) # Error if more colours requested than exist in palette if (n > n_available) { cli::cli_abort(c( - "x" = paste( + "x" = glue::glue( "There are not enough colours available in the `{palette}`", "palette from `{palette_type}_colour_palettes`", "({n_available} available)." ), - "i" = paste( + "i" = glue::glue( "Accessibility guidance recommends a limit of four", "colours per chart. If more than four colours are", "required, first consider chart redesign. If it is", - "essential to use more than four colours, the {ext_palettes}", + "essential to use more than four colours, the `{ext_palettes}`", "palette{?s} can be used." ) )) diff --git a/tests/testthat/test-colour_table.R b/tests/testthat/test-colour_table.R index 16b2292..3839c1d 100644 --- a/tests/testthat/test-colour_table.R +++ b/tests/testthat/test-colour_table.R @@ -19,8 +19,8 @@ test_that("Correct data used in table", { test_that("Example column filled with correct colours", { fill <- c() - for(i in tab$`_styles`$styles) { - if(names(i) == "cell_fill") fill <- c(fill, i$cell_fill$color) + for (i in tab$`_styles`$styles) { + if (names(i) == "cell_fill") fill <- c(fill, i$cell_fill$color) } expect_identical(toupper(unname(cols)), fill)