makeTransparent: makeTransparent

Usage Arguments Examples

Usage

1
makeTransparent(..., alpha = 0.5)

Arguments

...
alpha

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (..., alpha = 0.5) 
{
    if (alpha < 0 | alpha > 1) 
        stop("alpha must be between 0 and 1")
    alpha = floor(255 * alpha)
    newColor = col2rgb(col = unlist(list(...)), alpha = FALSE)
    .makeTransparent = function(col, alpha) {
        rgb(red = col[1], green = col[2], blue = col[3], alpha = alpha, 
            maxColorValue = 255)
    }
    newColor = apply(newColor, 2, .makeTransparent, alpha = alpha)
    return(newColor)
  }

jwolfson/visparty documentation built on May 20, 2019, 6:27 a.m.