Move on canvas and see the effect.

JavaScript

        $(canvas).colorSampler({
          onPreview: function (color) {
            $('#preview').css('background-color', color);
          },
          onSelect: function (color) {
            $('#selected').css('background-color', color);
          }
        });
      
Selected
Preview