"I noticed there’s an RGB LED that’s an optional indicator for the HC-SR04 board. I like the physical design of the addition but I’m curious about the single resistor approach. Are you intentionally relying on the different forward voltages and choosing specific colours for each pin? The general solution involves 3 resistors, sometimes with a value per diode.
It's a very good question. The 3 LEDs work best at different voltages. In a regular circuit, if they share the same resistor on the common cathode, the voltage over the LEDs will be the same. The lowest one will steal current from the others. It will result in a too bright color shadowing the other two colors.
When designing the decorative LED, my major concern was to fit the circuit into a limited space and make it easy to solder. The trick was, I picked a 1000 Ohm resistor (rather than 220 Ohm) to limit the overall brightness. What's more, the (R, G, B) values can be set between 0~255 by 3 independent PWM signals. So They are not sharing the same anode! The brighter color can be dimmed by setting a smaller PWM duty. Now every color has a chance to show up and mix.
Check the following rainbow spectrum generated by the LED test code.