Based on code from http://www.java2s.com/Tutorial/JavaScript/0571__jQuery/jQueryUISliderColorpicker.htm