I have a ceiling fan that looks like the below:
I noticed that there's a round cap in the middle of the fan.
Can I take the cap off, get a light fixture from my local Home Depot, and install it there?
Short answer: Yes, but don't.
Longer answer: You probably could lash up a light fixture there (although you would need to add a wire to those already running through the stationary shaft). The problem is that unless you use a kit made by the fan manufacturer, you are going to end up with something that you do not want hanging over the head of anyone you care about.
I was an electrical engineer for 45 years and I wouldn't do it, not without a design review committee and an extensive test program. You should install only standard equipment in your home using only approved methods.
It's not so much a matter of design and function as of testing and experience. The lighting fixtures, junction boxes, outlets, switches, etc. approved for sale in your local hardware outlet represent the cumulative experience of hundreds of thousands of skilled professionals cleaning up after millions of accidents, so that you won't have to.
Maybe- Look up the model # of the fan if it has an optional light kit get the kit for your light. With the kit designed for your light it would still be a UL listed assembly and totally legal. If you can’t find a kit for your light you are taking a chance.