shades_of returns a vector of n colors that are shades of an initial color col_1.

shades_of(n = 5, col_1 = "black", col_n = "white", alpha = NA)

Arguments

n

Number of desired colors. Default: n = 5.

col_1

Initial color. Default: col_1 = "black".

col_n

Final (n-th) color. Default: col_n = "white".

alpha

A factor modifying the opacity alpha (as in adjustcolor) to a value in [0, 1]. Default: alpha = NA (i.e., no modification of opacity).

Details

By default, the colors range from the initial color col_1 = "black" to col_n = "white", but specifying different initial and final colors yields other color ranges.

shades_of is only a convenient wrapper function for a common usecol command. However, usecol allows defining more complex color gradients (e.g., by specifying more than two colors).

See also

seepal to plot color palettes; usecol to use a color palette; defpal to define new color palettes; grepal for finding named colors.

Other color functions: grepal(), newpal(), seecol(), usecol()

Examples

grey50 <- shades_of(50, col_1 = 'grey1') seecol(grey50, title = "50 shades of grey1")
blue_black <- shades_of(5, Seeblau, col_n = "black") seecol(blue_black, title = "5 shades from Seeblau to black")
wine_white <- shades_of(6, Bordeaux, alpha = 1/2) seecol(wine_white, col_brd = "black", lwd_brd = .5, title = "Shades of semi-transparent Bordeaux")