Information must not be conveyed solely by colour.
In the first example, the information in the pie chart can only be understood by associating each segment with a colour; the second version is comprehensible even if the colours are absent.
In this example, pictograms are used instead of squares of different colours.