Hmmm. Looking at the code it seems to want to randomize the color a bit:
pixw = [255, 255, 255]
[...]
pixw_0 = random.randrange(lum + 32)
pixw_1 = random.randrange(lum + 32)
pixw_2 = random.randrange(lum + 32)
[...]
pdb.gimp_drawable_set_pixel(starsLayer, xsm, ysm, 4, pixw)
But pixw_{0|1|2} are never used, and it look like it should have been:
pixw[0] = random.randrange(lum + 64)
pixw[1] = random.randrange(lum + 64)
pixw[2] = random.randrange(lum + 64)
However, as the resident physics nazi, I want to point out that star colors are not completely random, they have the color of the radiating black body at a given temperature, in other words their hue is constrained to what is known as the "Plankian locus" (for instance you will never see a pink or green star). There are several ways to do that, from sampling an adequate color gradient to computing the approximate RGB of a random temperature(*).
In addition the script can likely be made faster by removing either lines 83 or 84 because these are duplicates.
Speaking of which, using set_pixel() is slow; in Python you can use "pixel regions" to get an array that represents the drawable, update the array, and then update the layer from the array at the end.
Adapting code from first reference below gives something like this:
Attachment:
Stars.png [ 18.82 KiB | Viewed 1128 times ]
Of course this isn't perfect because the temperatures are drawn linearly at random in the 3000K-15000K range and the actual distribution isn't linear.
(*) See:
https://www.codetd.com/en/article/9132898 https://forum.arduino.cc/t/kelvin-to-rg ... ion/883498