
This blog demonstrates how to drive a bi-color LED, or any 2 LEDs, by using only one microcontroller pin. Sinking or sourcing current from the LED selects which one will light up. Setting the pin as input turns both LEDs off.
Alternating between 0,1, and high-Z, both LEDs are fully controllable and even dimmable. The article also explains how to calculate the resistor values to get the desired current for the LEDs. The only drawback to this circuit is that consumption will increase because the voltage divider requires current even when the LEDs are off.

Yes the method you show does work.. BUT, it consumes more energy than needed because you’ll always have a current draw between V+ and GND..
A better solution for 3V systems is to exchange the LEDs with the Resistors, and that way you’ll only use one resistor. the voltage over the LEDs won’t be enough to turn them on.
For higher voltage systems, you can add in a diode to each LED to keep the system in check.
With the addition of one more resistor you can also two push buttons to that single pin, if that pin can be used as an analog input. So now you can put 2 LEDs (or 3 colors using the bicolor LED mentioned) plus 2 buttons on a single pin.