alphacol: Generate color of a given brightness / opacity

Description Usage Arguments Details Value Author(s)

Description

Create colors with a given transparency value, or mimick transparency by mixing with the background colour.

Usage

1
  alphacol(col = par("col"), alpha = 1)

Arguments

col

a valid color specification

alpha

numeric, alpha level, between 0 and 1.

Details

alphacol follows the concept of alpha compositing:
A number α between 0 and 1 controls how opaque the colour is. When printing a colour A with alpha-level α over a colour B, the result becomes αA + (1-α)B. Thus, alpha = 1 equals to a colour that overplots other colours, and for alpha = 0, the colour is invisible.

R allows to define RGB colours with true alpha transparency, however, not all devices support that. Therefore, the default behaviour of alphacol is to mix the input colour A with the background colour found by par("bg"). A colour with alpha < 1 thus actually also prints opaque. If you want to change this behaviour, let .plottopt$alphamixing = TRUE.

Value

a colour in RGB format. If alpha < 1, the colour is lighter than the input colour, see the details.

Author(s)

Ute Hahn, ute@imf.au.dk


plottools documentation built on May 2, 2019, 4:23 p.m.