Learning colors is an abstract concept. Once Matthew was familiar with certain objects like car, wagon, or ball, I started labeling them with colors. For example, white car, red wagon, or green ball. It's a way to expand his vocabulary and help him learn his colors.
The Melissa & Doug Sort & Stack toy was also a good way to learn 5 basic colors: red, blue, yellow, purple, and green. Each colored block is also a different shape so the toy can also be used for stacking, matching, sorting, and later on, sequencing. There are helpful activity suggestions on the bottom of the peg board as well.
Matthew received this Sort & Stack at Christmas last year. From our experience, this has been a very good developmental toy for him. He's very interested in stacking pegs or blocks and has the attention span and patience for this toy. If he didn't have the interest, attention, and patience for this toy, then it would not be a good toy for him and I would be looking for other ways to teach him colors.
It is mainly because of this toy that he is able to match colors and label them. Of course this skill wasn't developed overnight. His developmental therapist and I have been working on colors since he turned 2 in October last year. So it's been a work in progress. Now he consistently says "de" for red, "bu" for blue, "owo" for yellow, "pa" for purple", and "guh" for green. Here's a video (from February this year) of Matthew working on this toy with me.