You're half way there.
You need an inductor, not a capacitor if you're going to do that. The value will depend on the switching frequency, input voltage, LED voltage, current and maximum acceptable current ripple.
It's true that the current will vary depending on the input voltage but that...