change bgcolor according to cap