Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change color in svg file through command line (inkscape)

I have an .svg file with only one color. I want to change this color to another and export it through command line. (I have to do it about 100 times, so doing it by hand doesn't work.) I use Inkscape at the moment. I am able to change the background color and export with this command:

inkscape -f name.svt -e output_name.png -b #000080

But I cannot find the way to change the normal color. I find this verb:

org.inkscape.color.replacecolor

But I don't know, how to add the color I want to use, somewhere I read, that I cannot add variables to verbes, but in that case how can be this verb used?

Thank you in advance.

like image 633
Balazs Sipos Avatar asked Nov 26 '13 22:11

Balazs Sipos


1 Answers

This is not a general purpose solution, but since a SVG file is just XML internally, if your SVG file is simple enough you might be able to get away with a simple sed replacement. For example the following replaces #000000 (black) with #ffffff (white):

sed -e "s/#000000/#ffffff/" input.svg >output.svg

This may or may not be good enough for your needs.

like image 114
Grodriguez Avatar answered Sep 21 '22 15:09

Grodriguez