If you'd like to see this and more in software for flashlights please visit toykeeper's projects!
https://github.com/ToyKeeper/anduril
I loved this feature on my flashlight and used it exclusively on candle mode. There's a lot of thought that goes into it like PWM speed or direct drive for LEDs that may or may not cause flickering and a tradeoff between battery life and the electronics available.