Learn R Programming

scales (version 1.4.0)

col_mix: Mix colours

Description

Produces an interpolation of two colours.

Usage

col_mix(a, b, amount = 0.5, space = "rgb")

Value

A character vector of colours.

Arguments

a

Either a character vector of colours or a colour palette function.

b

A character vector of colours.

amount

A numeric fraction between 0 and 1 giving the contribution of the b colour.

space

A string giving a colour space to perform mixing operation in. Polar spaces are not recommended.

See Also

Other colour manipulation: alpha(), col2hcl(), colour_manip, muted()

Examples

Run this code
col_mix("blue", "red") # purple
col_mix("blue", "red", amount = 1) # red
col_mix("blue", "red", amount = 0) # blue

# Not recommended:
col_mix("blue", "red", space = "hcl") # green!

Run the code above in your browser using DataLab