Skip to content

Commit

Permalink
Fix lintr errors
Browse files Browse the repository at this point in the history
  • Loading branch information
alice-hannah committed Aug 7, 2023
1 parent 7c1bd63 commit 2131fb9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions R/sg_palette.R
Original file line number Diff line number Diff line change
Expand Up @@ -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."
)
))
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-colour_table.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 2131fb9

Please sign in to comment.