devctrl.utility.svg_recolor.replace_colors_in_all_svgs#

replace_colors_in_all_svgs(indir, outdir, replacements: dict[str, str], filename_pattern: str = '.*.svg', replace_existing: bool = False)[source]#

Replace the colors in all files in indir and write them to the equivalent location in outdir.

E.g. <indir>/subdir/file.svg becomes <outdir>/subdir/file.svg.

Non-existing directories in outdir are created.

Parameters:
  • indir – Input dir.

  • outdir – Output dir.

  • replacements – Dictionary of replacements key -> value

  • replace_existing – Whether to overwrite outfile if it already exists.

  • filename_pattern – The pattern to match filenames with.