Besides being able to convert between rgb to hsv colors you also can get away with just generating the gradients once, and tinting them later with the color property.
In this c3p the gradient generating code is commented out if you want to use it. Besides that the color conversions are just single line expressions
dropbox.com/scl/fi/35l84rzbgh45zp467a2ts/color_picker.c3p
Alternately I was interested in HSL and a circular color picker. Here is that.
dropbox.com/scl/fi/wfqyelkd0rm3bzgk15h5l/color_picker_HSL.c3p