mwg API
    Preparing search index...

    Function parsePaletteLists

    • ~PAL(a,b,c>x,y,z)'s two comma-separated colour lists, one per side of a single >. The modifier's own args have already been comma-split by parseImagePath before this runs (the same naive split every modifier's argument list goes through), so a,b,c>x,y,z arrives as the four separate tokens ['a', 'b', 'c>x', 'y', 'z'] - rejoining them with , recovers the original text before this does its own split on > and then ,, rather than assuming the list boundary landed on an argument boundary the way a naive args[0]/args[1] read would.

      Parameters

      • args: readonly string[]
      • Optionalresolve: (name: string) => number | undefined

      Returns PaletteMapping

      import { parsePaletteLists, parseImagePath, imageModifier } from '@datamoc/mw_games/two-d/render';

      const pal = imageModifier(parseImagePath('unit.png~PAL(ff0000,00ff00>0000ff,ffff00)'), 'PAL')!;
      console.log(parsePaletteLists(pal.args)); // { from: [0xff0000, 0x00ff00], to: [0x0000ff, 0xffff00] }