Do you see the pattern and colours when you first start up the computer too, or just while you are in OSX. If you see it all the time, then it sounds like your iMac could be part of a large number of the G5 iMacs that have fallen prone to graphics card failures. These models are notoriously know for having issues with either their capacitors or their video cards. If the issue lies with you graphics card, then the only way to fix it is to replace the logic board. Some people have had success with doing what they call a re-flow of the graphics card, but I would only suggest this is you feel comfortable with taking your mac apart, and at the same time have nothing else to loose. I had 3 of the original G5 iMacs in my household and they have all fallen to graphics card failures. You can probably find a lightly used logic board on eBay if you are really wanting to salvage this mac, most of these older parts are cheap of you look in the right places.
Hope this Helps