Making custom icon invert color when object selected

I believe the roller inverts the selected color automatically. Can you provide more details on what the problem is (code sample, etc.)?