Learn R Programming

colortools (version 0.1.5)

sequential: sequential HSV colors

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

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.

See Also

pizza

Examples

Run this code
# 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")

Run the code above in your browser using DataLab