// returns pairs (color name, percentage of image) static LPair dominant332webColorNamesWithPercentage(RGBImage img) { new Map map; for (Pair p : dominant332colorsWithPercentage(img)) { S col = webColorNameFrom332(p.a); map.put(col, or(map.get(col), 0.0) + p.b); } ret sortByPairBDesc(mapToPairs(map)); } static LPair dominant332webColorNamesWithPercentage(BufferedImage img) { ret dominant332webColorNamesWithPercentage(RGBImage(img)); }