I found out that Aseprite palette generation is also not perfect. Many colors in palette don’t match RGB colors of image after “New Palette from Sprite” operation. So I’ve written a simple Lua script to generate palette from RGB sprite with EXACTLY same colors used in image across all frames. Please prefix required layers with + or # sign for script to process them.
Also here is new version of RGB-to-Indexed conversion script. It’s still required to keep right colors after conversion, because “Sprite → Color Mode → Indexed” doesn’t do the thing right. Mark your layers with + or # sign prefix and click OK after each converted layer added to new sprite. Then save new Indexed sprite to file.
eg_rgbconv.lua eg_rgbconv.lua - Google Drive