dot-replace_hex_alpha: Replaces the AA part of a #RRGGBBAA hex-colour.

.replace_hex_alphaR Documentation

Replaces the AA part of a #RRGGBBAA hex-colour.

Description

RGB colours can be encoded as hexadecimal values, as for example internally used by ggplot2. For this, the numerical RGB values are mapped from their 0-255 value range to two-character hex-values. This yields a string in the form of '#RRGGBB'. Additionally, a fourth optional block can be present encoding the alpha transparency of the colour. This extends the string to '#RRGGBBAA'. This function takes an '#RRGGBBAA' string as input for colour and a two-character hex-representation of an alpha value as an input for new_alpha, replaces the 'AA' part of colour with the new_alpha and returns the new colour.

Usage

.replace_hex_alpha(colour, new_alpha)

Arguments

colour

A character string of the format #RRGGBBAA.

new_alpha

A two-character string with the new alpha value.

Value

A hex-encoded RGBA colour.


visR documentation built on May 29, 2024, 11:50 a.m.