Function: mergeColorClasses()
mergeColorClasses(
svg,colors,sourceClassIds,targetClassId,targetColor):object
Merges multiple SVG color class IDs into a single unified color. This is useful for consolidating near-identical colors in vectorized SVGs.
Parameters
svg
string
The SVG string to modify
colors
{[key: string]: ColorDefinition; }
Current color definitions map
sourceClassIds
string[]
Array of class IDs to merge (e.g., ["ff0000", "fe0101"])
targetClassId
string
The class ID to merge into (e.g., "ff0000")
targetColor
The color definition for the merged result
Returns
object
Updated SVG string and color map
colors
colors:
object
Index Signature
[key: string]: ColorDefinition
svg
svg:
string