Select one or more colors from the Flexoki palette.
Arguments
- col
Character string specifying one or more hues of colors (see Details).
- sat
Number specifying the saturation level. If
col = "paper"
orcol = "black"
this defaults tosat = NA
(see Details).- code
Character string specifying the form of color code (default =
"hex"
).- palette
Name of the chosen color palette;
flexoki
is the only option at this time.
Value
For code = "hex"
, a scalar (or vector) of one (or more) hexadecimal color code(s).
For code = "rgb"
, a tibble with columns c("red", "green", "blue")
Details
There are three different options for monochromatic base hues: off-white (col = "paper"
), black (col = "black"
), and a 12-level gray-scale (col = "gray"
or col = "base"
).
There are several options for accent colors, each specified using the col
argument and offered in 12 increasing levels of saturation. The color options are:
c("red", "orange", "yellow", "green", "cyan", "blue", "purple", "magenta")
The level of saturation is denoted by an integer from the following set, ordered from lightest to darkest:
c(50, 100, 150, 200, 300, 400, 500, 600, 700, 800, 850, 900, 950)
.
The function will work with vector arguments for col
and sat
. If the vectors are the same length, the function assumes a 1:1 correspondence between a specified color and the saturation, such that col = c("red", "blue")
and sat = c(100, 200)
would yield the hexadecimal equivalent of "red-100"
(#FFCABB
) and "blue-200"
(#92BFDB
). If one of the arguments is a vector and the other is a scalar, the shorter argument is recycled (see examples).
Examples
## two different colors with same saturation levels
#> flex(c("blue", "red"), 100)
## two different colors with same saturation levels in RGB
flex(c("blue", "red"), 100, code = "rgb")
#> # A tibble: 2 × 3
#> red green blue
#> <int> <int> <int>
#> 1 198 221 232
#> 2 255 202 187
## gray with different saturation levels
flex("gray", c(100, 200))
#> [1] "#E6E4D9" "#CECDC3"
## three colors with specific saturation levels
flex(c("blue", "red", "green"), c(100, 200, 300))
#> [1] "#C6DDE8" "#F89A8A" "#A0AF54"