Light to only come on between sunset and sunrise

A complete noob question here but I’ve spent way to long trying to get this to would, it’s suck a simple thing but I just don’t seem to be able to do it.
What I want is when I close a door for the light to only come on between sunset and sunrise, I know it can’t be that hard but it just don’t seem to work at all for me…
Thanks

Presumably you’re writing an automation using a door closing as the trigger and the sun condition? Depends a bit what kind of lights you have - for Philips Hue the action would involve a device, for something connected to a socket or smart switch you would more likely need to call a service - switch.turn_on maybe.