I wanted to replace some colours in an image. The source file is an SVG file of some complexity, but it only contains a few distinct colours. I thought the easiest way to replace the colours would be to use one of the functions in Inkscape, a great open-source vector image editor. However, I opened it and didn’t see an obvious way, so decided to do it at the command-line. It might work for you, too, if you’re running a unix-like operating system (e.g. Linux, Mac OS).
Step 1: Find a list of all of the colours used in your image:
tr '"' '\n' < filename.svg |grep '#'|sort|uniq
This will output something like this:
#261010 #605338 #666D7A #717B8C #778A9F #7E7372 #8FAECB
Step 2: Replace the colour you don’t like, using a text editor or the command line. I used nano (ctrl-\ does find-and-replace) but you could do it at the command line if you only have one replacement to do:
tr '#261010' '#FFFFFF' < old.svg > new.svg