Automatic color palette detection