Takes a hex code like '#C0FFEE' and simplifies to '#CFE' (i.e. the first character from each character pair).

dh_shorten(hex_code)

Arguments

hex_code

Character. A valid hex colour code starting with a hash mark (#). Characters must take the values 0 to 9 or A to F (case insensitive).

Value

Character. A shortened hex colour code: a hash mark followed by three characters (0 to 9, A to F).

Examples

dh_shorten("#C0FFEE")
#> [1] "#CFE"