Learn R Programming

quickcode (version 1.0.6)

mix.cols.btw: Mix or Blend colors between two or more colors

Description

Mix or blend multiple colors between two colors

Usage

mix.cols.btw(colors, max = 20, alpha = 1, preview = FALSE)

Value

color hex for all generated colors

Arguments

colors

the vector of two colors

max

maximum number of colors to blend between

alpha

alpha for the new color blends

preview

LOGICAL. preview all color generated

Examples

Run this code
# simply mix/blend two colors
mix.cols.btw(c("red","brown"))

# simply mix/blend two colors, maximum number of colors at the end
mix.cols.btw(c("red","brown"), max = 8)

# simply mix/blend two colors with alpha=0.2 (opacity=0.2)
mix.cols.btw(c("yellow","green"),alpha = 0.2)

# also preview after mixing the two colors
mix.cols.btw(c("red","green"), preview = TRUE)
mix.cols.btw(c("blue","violet"),alpha = 0.2, preview = TRUE)

mix.cols.btw(c("red","purple","yellow","gray"), preview = TRUE)

mix.cols.btw(c("red","purple","yellow","gray"),alpha = 0.2, preview = TRUE)

Run the code above in your browser using DataLab