Skip to content

ColorMapPerFiles

Defined in: types.ts:443

Maps original SVG colors (case-insensitive) to their replacements per specified files.

const map = {
// Files where colors should be replaced
files: ["my-file.svg", /icon\-*.\.svg/],
// Color replacements
replacements: {
// Will replace all colors with "red" value with "var(--primary-color)".
// It'll replace only "red" value. HEX ("#ff0000"), RGB ("rgb(255, 0, 0)") and other values won't be affected.
"red": "var(--primary-color)",
// Same as above: this HEX value (case-insensitive) will be replaced with "var(--secondary-color)".
// Any other value with the same color (such as "blue" or "hsl(240deg 100% 50%)") won't be affected.
"#0000ff": "var(--secondary-color)",
// Again, only this value (case-insensitive) will be replaced with "var(--tertiary-color)".
// Any other value won't be affected.
"rgb(0, 255, 0)": "var(--tertiary-color)",
},
// A default color for unspecified colors.
// If not specified, "currentColor" is used.
// If an empty string specified, other colors won't be affected.
default: "red",
}

optional default: string

Defined in: types.ts:459

Replacement for other colors. Set to empty string to leave colors untouched.

"currentColor"

files: FileMatchers

Defined in: types.ts:447

Files where colors should be replaced. See FileMatchers for the available formats.


replacements: ColorMap

Defined in: types.ts:452

Color replacements. See ColorMap for the details.