Optionalresolve: (name: string) => number | undefinedimport { parseColorPairs, parseImagePath, imageModifier } from '@datamoc/mw_games/two-d/render';
const rc = imageModifier(parseImagePath('unit.png~RC(magenta>ff0000)'), 'RC')!;
const mapping = parseColorPairs(rc.args, (name) => (name === 'magenta' ? 0xff00ff : undefined));
console.log(mapping); // { from: [0xff00ff], to: [0xff0000] }
~RC(src>dst,src>dst,...)'s pairs, each side hex (#c0ffee,c0ffee) or, whenresolveis given, a named colour (~RC(magenta>red)) it resolves. A pair whose either side is neither hex nor resolvable is dropped rather than aborting the whole list.