Last active
October 3, 2018 18:34
-
-
Save zappingseb/2b3b51b01b204854434b10db59a39855 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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