No, you don't have to rely on wire colors to figure out what's what.
With nothing more than a decent multimeter and premix flame (blowtorch or gas stove), a two-test sequence can reveal the identity of each wire, assuming the O2 sensor is fully-functional:
Determine the heater wires
This should be done first. These wires serve to heat up the O2 sensor to bring it up to operating temperature via a resistance-based heating element.
To test, set the multimeter to resistance mode and use it to probe and figure out which wires register a resistance (usually 4-6 Ω). The two wires which register a resistance reading are the heater wires; the other two will show up as an open circuit or infinite resistance.
As the O2 heater is resistor-based, polarity is not a concern here. Note down which two wires correspond to the heater circuit and proceed to Test 2.
Determine sensor signal polarity
The O2 sensor signal gives an indication of oxygen content sensed by the probe by sending an induced voltage that corresponds to the level of oxygen detected. However, this does require the sensor to be heated up to operating temperature. Necessary precaution must be taken.
To test, set the multimeter to voltage mode and attach its probes to the two non-heater wires, noting which probe is negative and which is positive. Heat up the sensor's tip with the premix flame. Within a minute, the sensor should register a voltage in the 0-1 V range.
If the voltage signal is positive, this indicates that the positive multimeter probe is connected to the signal wire and negative probe is connected to earth.
If the voltage signal is negative, the multimeter probes have been connected in the opposite sense, so the negative probe is connected to the signal wire, while the positive probe is connected to earth.