Small footprint constant current source / voltage regulator
It is best to match the LED String to your regulated Supply or visa versa using any SMPS with &lt;2% error.

Each LED is like a 3V Zener  typically Vf=3.1 to 3.3 (20 to 30mA)
You can use  a string of 7, while 6 is less efficient
Each 20mA White LED is approximately Vf=2.85[V] + If[A] * 15[Ω] (more good quality modern HB 5mm LEDs, not old ones) i.e Iv&gt; 10,000 mcd

high power LEDs have a lower Rs  ~ &lt;= 1/Pmax



Thus using only a series Rs to regulate current 24V since both LEDs Vf and 24V are stable.
for V+=24V
  #LEDs If[mA]  Vf[string]  Rs  P(Rs)    
    6    20     18.9V      255   100mW~  (use 1/4W R per string)
    6    30     19.8       140   130mW~
    7    20     22.1       100    40mW~  (1/8W is OK)
    7    30     23.1        30    27mW~   (1/16W is OK to use)
    8       est. 24.05/8=3.00V &gt; - 2.85V = 150mV &gt; / 15 ohms = 10 mA  
            roughly  YMWV With Rs=0