There are already a number of gamut visualizers available, but none of the ones I know of have any visual representation of the frequency in which a color is used, so I wrote my own. The difference with other gamut visualizers is that the colors that are less used will be more transparent than the ones that are more frequently used. This allows you to have more information about color usage and helps you determine which zones of the color wheel have been used more in the image.
After some searching I found the solution in the Paper.js Google Group, so I'm passing it along hoping to increase its visibility. The trick consists of creating a global object from PaperScript that will hold all the functions and variables that you want to pass along without polluting too much the global scope, only with this object holding all the rest under it.