Color is more than just the beautiful skin of a painting. Color is one of the elements of design, along with value, line, shape, etc. And so it functions in the overall design according to design principles. If you're a student of ours you probably have a list of the elements and principles of design around somewhere. If not, this will be a brief sample of three of the principles and how they work.
The first principle of design is unity. A work has "unity" when all its parts work together to present a focused message. Contrast, (or "conflict") the second principle, breaks "unity" up into interesting pieces. The third principle is dominance, which "...resolves conflict and restores unity." (Quote by Edgar Whitney, who prefers the term "conflict").
In "Daisies and Sunlight," above, we have a lot of warm color (dominance), with a few important notes of "cool"...the pure blue areas on the petals that are meant to stand for "skylight"...for contrast. Those few cool notes are made more emphatic by the warm dominance, and provide a welcome relief and surprise for the eye. The picture would be much less successful without them.