Polymeric derivatives of dicyandiamide were synthesized via a bulk thermal condensation method, using a range of process temperatures between 400 and 610 °C. The obtained carbon nitride powders exhibit an optical transition in the UV-green range that has been assigned to the direct bandgap of a semiconductor-like material. Within this context, the apparent bandgap is linearly tunable with increasing process temperatures, showing a temperature coefficient of - 1.7(1) meV K(-1) between 2.5 and 3.0 eV. The obtained results show a predominant optical transition within the tri-s-triazine unit of the polymer, with a bathochromic shift originating from a gradually increasing degree of polymerization.