First, I'm not aware of the underlying color conversion, but I'm not sure if the code does what the comment implies.

Wouldn't a simple `H += np.pi` be sufficient and faster?