iBooks does this. When there is a lot of ambient light, the white theme is used. When there is less, it automatically switches to a dark theme. Something like this in Matcha would be great. If messes scary, it could be toggled by a switch called night mode.
Moreover, over the day, the app could gradually transition from light to dark mode.
I think all you need for this is the time on the system clock.