I see! I got confused because of the sprite palette changing trick to have more than 4 colors, so it only really works for foreground sprites larger than 16x16. Either that or I'm getting NES and Gameboy mixed up. Added a fixed version! No 16x16 tile has more than 4 colors, and the background has a max of13 colors!
Thanks for the heads up!