.replace_hex_alpha | R Documentation |
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.
.replace_hex_alpha(colour, new_alpha)
colour |
A character string of the format #RRGGBBAA. |
new_alpha |
A two-character string with the new alpha value. |
A hex-encoded RGBA colour.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.