devctrl.utility.svg_recolor.replace_colors_in_svg#

replace_colors_in_svg(infile: str, outfile: str, replacements: dict[str, str], replace_existing: bool = False) str[source]#

Replace the colors of infile and save as outfile.

Non-existing directories in outfile are created.

Parameters:
  • infile – Input file.

  • outfile – Output file.

  • replacements – Dictionary of replacements key -> value

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

Returns:

Output file content.