It seems that the comments are somewhat misleading because the hue value can never exceed 255. Perhaps the comments are a leftover from another context?
In fact it would seem that by simply changing the type of hue to 8-bit rather than 16-bit, one could simply remove the if block, because addition automatically wraps around…
Neither are they modified anywhere in the program nor are they exposed to the user to be configurable. I’ve submitted a PR with some cleanups and can add a commit either exposing this to the user or conversely just integrating the constant into the code.
Code clarity, mostly. rainbow_hue += rainbow_steps is easier to understand than rainbow_hue += 1 - no magic constants. Mind you, marking this const or something may help, but I’d keep it for the name, and let the compiler do the inlining.
Only until we don’t ever want to change it, to speed things up, for example. Then hue++ would be fine. If we want to keep changing it an option, hue += step feels - to me - nicer. Under the hood, they can likely compile to the same thing, but the += step variant is a tiny bit easier to change later on, or to make public, if so desired.
On the other hand, this is not a very strong opinion, so if @jesse is fine with just inlining, that works for me as well.
It’s my preference to not throw away the steps variables. We’ve had different default values at different times, there’s no run time overhead and I prefer the explicitness.