Artificial intelligent assistant

How to calculate civil twilight timings? I am writing a program that requires calculations of civil twilight timings. I know how to calculate sunrise and sunset timings(actually I just searched online for a formula and copied it into my code blindly), but I can't find any resources on twilight timings. Everything I know about this is that when the sun elevation is from 0 to -6 degrees, it's civil twilight.

As per as my knowledge, for Hour angle calculation you are using Zenith distance as 90.833 degrees, just replace 90.833 with 96 degrees(Civil twilight), 102 (Nautical) and 108 (astronomical)!enter image description here

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 60ce9c8589075fd4a066ae03de9c4f27