Mass change the colour of 300 .svg files


I have 300 .svg files, all are black, simple vector graphics. Is there any chance to change color from black to white ? Of course mass.

Thanks Ad

12/25/2015 12:05:00 AM

You could use a "sed" script like this (

for x in $*
sed -e "s/#ED1C24/#ccddee/g" $x > temp$x
mv temp$x $x

Run it with " *.svg"

As mentioned in @hsawire's answer, this can't be "undone" either, so to be safe it's best to copy your original SVG files into another directory for safe-keeping before doing a batch edit on them.

Or use a similar script with your favorite text editor, so long as your editor can be "batched" or "scripted", e.g. hsawires' demo with Dreamweaver.

Be sure your colors in the source SVG are actually expressed in HEX. Sometimes they are represented in other ways; for example the ImageMagick command

convert -size 8x8 -xc:black -bordercolor \#888 -frame 8x8 file.svg

produces a 24x24 SVG file with the pixels expressed as an embedded PNG, and a simple text editor won't work on such SVG files.

12/25/2015 4:00:00 PM