# Generate 3 distinct colors from the default color space
qualpal(3)
# Provide a custom color space
qualpal(n = 3, list(h = c(35, 360), s = c(0.5, 0.7), l = c(0, 0.45)))
qualpal(3, "ColorBrewer:Set2")
# Adapt palette to deuteranopia
qualpal(5, "ColorBrewer:Dark2", cvd = c(deutan = 1))
# Adapt palette to protanomaly with severity 0.4
qualpal(8, cvd = c(protan = 0.4))
# Generate and extend a palette with 3 colors, using the DIN99d
# metric
pal <- qualpal(3)
qualpal(5, extend = pal$hex, metric = "din99d")
if (FALSE) {
# The range of hue cannot exceed 360
qualpal(3, list(h = c(-20, 360), s = c(0.5, 0.7), l = c(0, 0.45)))
}
Run the code above in your browser using DataLab