2

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

6
  • 1
    Hello and welcome to GD.se. Usually you need to show what you have tried so we know what your level of expertice is. Right now this question comes in as: This is what i need, please do my work for me type of question. This is also most probably why your getting downvoted. Please edit your question or there is a high risk it will get closed.
    – joojaa
    Dec 25, 2015 at 8:11
  • Possible duplicate of Batch replace image color
    – Wrzlprmft
    Dec 25, 2015 at 8:31
  • @joojaa ok but what I should show ? it's easy question similar to "how to do something in PS ?". I didn't upload 300 files here and say "change this colour files for me", just ask.
    – adm
    Dec 25, 2015 at 15:25
  • Well for starters you should explain what kind of infrastructure you have. This isnt even scoped atleast with how to do on PS has a clear scope right now theres a milion software you could use. Text editing is not nesseserily smart as there can be all sorts of hard corner cases. For example color is in shorthand rgba instead of hex color etc...
    – joojaa
    Dec 25, 2015 at 16:40
  • Also available is flaque.github.io/penguin
    – Ryan
    Aug 27, 2019 at 14:49

2 Answers 2

3

You could use a "sed" script like this (change.sh):

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

Run it with "change.sh *.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.

1
  • for straight copy-pasters, be aware, that the script will fail with files having spaces in their names, like "test-file one.svg" Aug 28, 2019 at 14:33
2

Yes sure,

First you have to Define a site in Dreamweaver and make sure to associate .SVG with Dreamweaver.

Use Find and Replace or click Ctrl / cmd + F select from "Find in" list Entire Current Local Site and from search list Source codeand in the Find text box type the color that you want to replace and in the Replace text box type the new color that you want. and click Replace All

enter image description here

please note that this action could not undo

7
  • 1
    More generally, use any text editor's find-and-replace feature to change the fill color in your .svg files. Dec 25, 2015 at 14:08
  • @GlennRanders-Pehrson sure ... but the idea behind defining a site is to change all the 300 files at once. not need to open each.
    – hsawires
    Dec 25, 2015 at 15:09
  • 1
    Thank you all for your help, but @hsawires are right. I know that I can open every file in text editor and change the colour but it is the same like open it in AI and do it. But generally I think use text editor to solve this problem is good idea because it's more flexible than AI.
    – adm
    Dec 25, 2015 at 15:20
  • @hsawires Understood. I'd use a "sed" script because that's what I'm comfortable with. People can use any text editor that they like, as long as it can be scripted or recorded. Dec 25, 2015 at 15:22
  • @GlennRanders-Pehrson sure, forgive my ignorance, maybe your solution gives another dimension to me. I will start learn more about sed script. Thank you.
    – hsawires
    Dec 25, 2015 at 15:32

Not the answer you're looking for? Browse other questions tagged or ask your own question.