Alembic is a Sketch plugin that extracts a color palette from any layer that contains bitmap data. This works for both images and layers with a Pattern fill.
Rename all your layers in one click. That's pretty much it. This plugin is free forever and Open Source, if you are targeting an AI or design audience, consider becoming a sponsor to get your name on the official site. https://github.com/sponsors/Hugo-Dz