What gives the apple it's color?

what is it that makes apples green or red? is it exposer to sun or something b/c i dont know...plz relate it to chemistry... thanx!
3 answers 3