Suppose I have this vector of colors in hex code (in R
):
colors <- c("#62B200","#FF6C91","#F57962","#00C1A9","#EE8044")
I'm looking for a way to expand each color with n
darker shades of it (i.e., pulled towards black).
So for example, if n
= 2, this will be the expanded colors data.frame
:
expanded.colors.df <- data.frame(original.color = c("#62B200","#62B200","#FF6C91","#FF6C91","#F57962","#F57962","#00C1A9","#00C1A9","#EE8044","#EE8044"),
expanded.color = c("#62B200","#58A000","#FF6C91","#E56182","#F57962","#DC6C58","#00C1A9","#00AD98","#EE8044","#D6733D"))
I took these shades from here, which for a given color input gives a list of shades of it.
Any idea if there's an R
function to achieve this?