tests/testthat/test-brain_palettes.R

test_that("Check that palette extraction happens ok", {
  expect_is(class(brain_pals_info()), "character")
  expect_equal(length(brain_pal("dk", 13, unname = TRUE)), 13)
  expect_equal(length(brain_pal("dk", 13, direction = -1)), 13)
  expect_equal(length(brain_pal("aseg")), 45)

  expect_equal(length(brain_pal("aseg", n = 1:8)), 8)
  expect_equal(length(brain_pal("aseg", "all")), 45)

  expect_warning(length(brain_pal("aseg", 2)), "3")
  expect_equal(length(brain_pal("aseg", 22, unname = TRUE)), 22)
  expect_warning(brain_pal("dk", 50))
  expect_error(brain_pal("yeo"))
})

Try the ggseg package in your browser

Any scripts or data that you put into this service are public.

ggseg documentation built on Dec. 22, 2025, 5:06 p.m.