sequential: sequential HSV colors

Description Usage Arguments Details Author(s) See Also Examples

View source: R/sequential.R

Description

This functions allows to get a sequence of colors in an HSV model with optional pre-especified numbers for saturation, value, and alpha. It is a very flexible function to play with different combinations of saturation, value, and alpha.

Usage

1
2
3
  sequential(color, percentage = 5, what = "saturation",
    s = NULL, v = NULL, alpha = NULL, fun = "linear",
    plot = TRUE, verbose = TRUE)

Arguments

color

an R color name or a color in hexadeciaml notation

percentage

numeric value indicating the increment steps of the sequence in percentage

what

character string indicating what parameter to taki into account to generate the sequence. Possible values are "saturation", "value", and alpha

s

optional decimal value (between 0 and 1) to fix the color saturation

v

optional decimal value (between 0 and 1) to fix the color value

alpha

optional decimal value (between 0 and 1) to fix the color alpha transparency

fun

character string indicating the applied transformation to the generated sequence. Possible values are "linear", "sqrt", and "log"

plot

logical value indicating whether to plot the sequence

verbose

logical value indicating whether to return the color names of the sequence

Details

The idea bechind this function is to explore a sequence of colors given some fixed numbers of saturation, valur or alpha for an HSV color model. The argument what will be taken to generate the sequence in the given percentage increment steps. In addition, we can specify a number for s, v, alpha. For example, if what="value", we can fix the saturation in s=0.8, obtaining a sequence of colors with different values but with the same level of saturation.

The argument fun allows to apply a transformation to the generated sequence. By default fun="linear", no transformation is applied. If fun="sqrt", the square root of the generated sequence will be taken. If fun="log", the logarithmic of the generated sequence will be taken.

Author(s)

Gaston Sanchez

See Also

pizza

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# sequence for 'orange'
sequential("orange")

# sequence for 'orange' with fun='sqrt' transformation
sequential("orange", fun = "sqrt")

# sequence for 'orange' with fun='log' transformation
sequential("orange", fun = "log")

# sequential sequence for value with fix saturation s=0.7 and fun='log'
sequential("orange", what = "value", s = 0.7, fun = "log")

# sequential sequence for saturation, with fix value s=0.8, alpha=0.5, percentage 10, and fun='log'
sequential("orange", 10, what = "value", s = 0.7, alpha = 0.5, fun = "log")

Example output

 [1] "#FFFFFFFF" "#FFFBF2FF" "#FFF6E6FF" "#FFF2D9FF" "#FFEDCCFF" "#FFE9BFFF"
 [7] "#FFE4B3FF" "#FFE0A6FF" "#FFDB99FF" "#FFD78CFF" "#FFD280FF" "#FFCE73FF"
[13] "#FFC966FF" "#FFC559FF" "#FFC04CFF" "#FFBC40FF" "#FFB733FF" "#FFB326FF"
[19] "#FFAE19FF" "#FFAA0DFF" "#FFA500FF"
 [1] "#FFFFFFFF" "#FFEBC6FF" "#FFE3AEFF" "#FFDC9CFF" "#FFD78DFF" "#FFD280FF"
 [7] "#FFCE73FF" "#FFCA68FF" "#FFC65EFF" "#FFC354FF" "#FFBF4BFF" "#FFBC42FF"
[13] "#FFB939FF" "#FFB631FF" "#FFB42AFF" "#FFB122FF" "#FFAF1BFF" "#FFAC14FF"
[19] "#FFAA0DFF" "#FFA706FF" "#FFA500FF"
 [1] "#FFFFFFFF" "#FFFBF3FF" "#FFF6E7FF" "#FFF2DBFF" "#FFEFD1FF" "#FFEBC6FF"
 [7] "#FFE7BCFF" "#FFE4B2FF" "#FFE1A9FF" "#FFDEA0FF" "#FFDB98FF" "#FFD88FFF"
[13] "#FFD587FF" "#FFD27FFF" "#FFCF78FF" "#FFCD70FF" "#FFCA69FF" "#FFC862FF"
[19] "#FFC55BFF" "#FFC355FF" "#FFC14EFF"
 [1] "#000000FF" "#0C0904FF" "#181207FF" "#241B0BFF" "#2E230EFF" "#392B11FF"
 [7] "#433214FF" "#4D3A17FF" "#56411AFF" "#5F471CFF" "#674E1FFF" "#705422FF"
[13] "#785A24FF" "#806026FF" "#876629FF" "#8F6B2BFF" "#96712DFF" "#9D762FFF"
[19] "#A47B31FF" "#AA8033FF" "#B18535FF"
 [1] "#00000080" "#18120780" "#2E230E80" "#43321480" "#56411A80" "#674E1F80"
 [7] "#785A2480" "#87662980" "#96712D80" "#A47B3180" "#B1853580"

colortools documentation built on May 2, 2019, 2:10 p.m.