Tetrahedrally coordinated Co2+ in oxides and silicates: Effect of local environment on optical properties