Carbon is a versatile element that has allotropes with both sp2 (graphene) and sp3 (diamond) bonding. However, none of the allotropes can be used as light-absorber materials in solar cells due to either too large or too small band gap. Here, we propose a novel concept that enables a tunable band gap of carbon phases with sp2 carbon atoms within a sp3 carbon structure. The tunability is due to the quantum confinement effect. By embedding the sp2 atoms within the sp3 structure, we can design new carbon allotropes with ideal optical properties for optoelectronic applications. Five carbon allotropes incorporated this structural feature were identified by combining this new concept with our freshly developed multi-objective inverse band structure design approach. They all have proper band gaps for optical absorption, and the simulated photovoltaic efficiency of C10-C is even higher than conventional absorber materials such as GaAs, which indicates that C10-C with mixed sp2sp3 hybridization may have potential application as light-absorber material in electronic and optoelectronic devices.