Skip to content

Instantly share code, notes, and snippets.

@zappingseb
Last active October 3, 2018 18:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zappingseb/2b3b51b01b204854434b10db59a39855 to your computer and use it in GitHub Desktop.
Save zappingseb/2b3b51b01b204854434b10db59a39855 to your computer and use it in GitHub Desktop.
// Function to check a doublecolorpicker
// item by id
function check_doublecolorpicker(id){
// derive an empty array of two inputs with
// colors
values = [];
// push the two colors into the array
$("#"+id).find('input').each(function(item){
values.push($(this).val());
});
// derive the closeness of the two colors
// delete the # sign by substring(1)
closeness = hexColorDelta(values[0].substring(1),values[1].substring(1));
// If the colros are too close, show a warning inside the
// id element
if(closeness>0.8){
$('#'+id + ' div.warning').show();
}else{
$('#'+id + ' div.warning').hide();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment