col_mix {scales}R Documentation

Mix colours

Description

Produces an interpolation of two colours.

Usage

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

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.

Value

A character vector of colours.

See Also

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

Examples

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!

[Package scales version 1.4.0 Index]