SVG Modder
One way of defining an SVG file is using stylesheets. That is the way that Adobe Illustrator does it. An SVG file is an XML-format text file, so modifying the stylesheets definitions is quite straightforward.
The Javascript for this page takes each of the ‘fill’ definitions of the input file‘s stylesheets in turn, where the fill colour is specified as hexadecimal, and modifies them according the the criteria chosen by the radio button options.
The radio buttons are colour selection buttons similar to my
Mosaic Tiles page and my
Mosaic Stars page where a number of colours can be chosen by colour-pick.
Each of the stylesheet ‘fill’s is matched to the picked colours and the nearest is chosen to replace the ‘fill’ colour. Nearest is on brightness, hue and saturation, each matched separately by percentage difference and the lowest of the aggregate of the three percentages is chosen.