Learn R Programming

colorfast (version 1.0.1)

set_alpha: Set alpha value of integer colors

Description

Set alpha value of integer colors

Usage

set_alpha(icol, alpha)

Value

integer vector of colors with adjusted alpha channel

Arguments

icol

Integer vector (where the 4 bytes making up each integer represent the RGBA values of the color)

alpha

numeric alpha value in range [0, 1]. Length of 1, or same length as 'col'

Examples

Run this code
icol <- col_to_int('red')
icol
int_to_col(icol)
icol2 <- set_alpha(icol, 0.5)
int_to_col(icol2)

Run the code above in your browser using DataLab