# The basic idea:
library(monochromeR)
generate_palette(
"purple",
modification = "go_lighter",
n_colours = 5,
view_palette = TRUE
)rstats package update
## The basic idea
{fig-alt=“Five tiles going from”purple” to a lighter purple, with the hex codes for the colours printed in black and white within the top and bottom of each tile.” fig-align=“center”}
The view_palette() function can be used as a stand-alone function, allowing users to quickly view (and show the hex codes / colour names for) any palette they like…
view_palette(
c(
wesanderson::wes_palettes$Moonrise1,
wesanderson::wes_palettes$Moonrise2[1:2]
)
)… and feed them to colorblindr::cvd_grid(). First, let’s do that without the labels (and show that monochromeR can work from standard colour names).
monochromeR::view_palette(
c("red", "yellow", "purple", "green"),
view_labels = FALSE
)
colorblindr::cvd_grid()And here is the surprise, where including the the labels proved more useful than I’d realised. Even if the colours are perceived as different, the text may not stand out enough against the background colour for everyone.
monochromeR::view_palette(
c("red", "yellow", "purple", "green"),
view_labels = FALSE
)
colorblindr::cvd_grid()Thanks to charliejhadley for suggesting this update! It’s currently under review with CRAN, so in the meantime, install from GitHub to start using this feature.
github.com/cararthompson/monochromeR


