It's wrong yes.
You might want to ensure the palette is RGB, then use `PaletteInterface::name`