Adds a recursive function for assigning color, in case the user select
groups of shapes instead of shapes directly