Color picker RGB values

Hi all.

I'm trying to write a script that manipulates colors when using gamma 2.2.

Basically I want to have a color picker ("old") so the user can choose a colour and one next to it ("new") that is the result of the following equation.


This will make the RGB values correct when using gamma.

Any help on this would be much appreciated.