Learn R Programming

makeFlow (version 1.0.2)

addAlpha: addAlpha()

Description

Adds a specified opacity (between 0 and 1) to any color(s) listed.

Usage

addAlpha(col, alpha = 1)

Arguments

col
A vector of one or many colors.
alpha
A value between 0 and 1. 0 indicates complete transparency. 1 indicates complete opacity.

Value

Returns the Hexadecimal representation of the modified color(s).

Examples

Run this code

## The function is currently defined as
function (col, alpha = 1) 
{
    if (missing(col)) 
        stop("Please provide a vector of colors.")
    apply(sapply(col, col2rgb)/255, 2, function(x) {
        rgb(x[1], x[2], x[3], alpha = alpha)
    })
  }

Run the code above in your browser using DataLab