How charge regulation and ion-surface affinity affect the differential capacitance of an electrical double layer.