There's a simple method to check if your colors do what they're supposed to do: convert the whole image into greyscale. It sounds counter intiutive perhaps, but it works very well.
That's because it's not about the colors, it's about the relation between the colors. In other words, it's about contrasts. More in particular, about lightness contrasts. This is also a foolproof way to tackle the problem of color blindness. Whatever is visible in greyscale, will be visible to anyone.
I tried to find a few examples for you, but they're actually hard to come by in the world of software User Interface. So here are a few hardware examples, the good, the bad and the ugly.
This is a smart color scheme because it groups the buttons in a meaningful way. All the buttons contrast with their backgrounds, which makes them quite visible. Interestingly, the light buttons have a dark font, the dark buttons have a light font. Sounds obvious, no? For fun, you can check your own remote. Or your car's dashboard for that matter.
This remote is less smart. See how the light buttons have a light font? The colored buttons make little sense in this context. What do they mean? Moreover: 5% of all people won't be able to see the difference between the green and the red button. The only button that stands out is the yellow one. But what for I wouldn't be able to tell.
Here's today's worst. Good luck figuring out what these buttons do.
What you are trying to accomplish is not so very difficult. I'm actually in the process of writing articles on how to do this kind of stuff. Common sense has a lot to do with it. Nevertheless, it is not so easy to explain. For the time being, you might check out NASA's color pages.