Understand now.
Pg was ok, but when copying to screen - that was in RGB so outputted an interpretation of H=R , S=G, B=B
Well done. I though problem was elsewhere and accidentally solved the problem You can mostly ignore the code I posted, but have a look at it. There are a few things might help you along.