Every line of 'jquery remove background color' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
240 function hideBackgroundColor(bool) { 241 if (bool) { 242 $('.overlay').find('div').css('background-color', ''); 243 } 244 }
30 function replaceColor(img, color) { 31 let { width, height, data: imgd } = img; 32 let rgba = rgbaRegex.exec(color); 33 let cred, cgreen, cblue, calpha; 34 if (rgba) { 35 cred = parseInt(rgba[1], 10); 36 cgreen = parseInt(rgba[2], 10); 37 cblue = parseInt(rgba[3], 10); 38 calpha = Math.round(parseFloat(rgba[4]) * 255); 39 } 40 else { 41 cred = parseInt(color.substr(1, 2), 16); 42 cgreen = parseInt(color.substr(3, 2), 16); 43 cblue = parseInt(color.substr(5, 2), 16); 44 calpha = parseInt(color.substr(7, 2), 16) || 0xff; 45 } 46 if (calpha === 0xff) { 47 for (var i = 0; i < imgd.length; i += 4) { 48 // Horrible workaround for imprecisions due to browsers using premultiplied alpha internally for canvas 49 let red = imgd[i]; 50 if (red === imgd[i + 1] && red === imgd[i + 2] && (red === 0x80 || imgd[i + 3] < 0xff && red > 0x70)) { 51 imgd[i] = cred; 52 imgd[i + 1] = cgreen; 53 imgd[i + 2] = cblue; 54 } 55 } 56 } 57 else { 58 for (var i = 0; i < imgd.length; i += 4) { 59 let red = imgd[i]; 60 let alpha = imgd[i + 3]; 61 if (red === imgd[i + 1] && red === imgd[i + 2] && (red === 0x80 || alpha < 0xff && red > 0x70)) { 62 if (alpha === 0xff) { 63 imgd[i] = cred; 64 imgd[i + 1] = cgreen; 65 imgd[i + 2] = cblue; 66 imgd[i + 3] = calpha; 67 } 68 else { 69 alpha = alpha * (1.0 / 255); 70 imgd[i] = Math.round(cred * alpha); 71 imgd[i + 1] = Math.round(cgreen * alpha); 72 imgd[i + 2] = Math.round(cblue * alpha); 73 imgd[i + 3] = Math.round(calpha * alpha); 74 } 75 } 76 } 77 } 78 }
55 function setColor ( element ) 56 { 57 // set background 58 element.setBackgroundColor ( getBackgroundStyle ( data ) ); 59 }
61 function checkBackgroundColor(elemID) { 62 var foo = window.getComputedStyle(document.getElementById(elemID)).backgroundColor; 63 return window.getComputedStyle(document.getElementById(elemID)).backgroundColor; 64 }
290 function setBackgroundStyles(image_url){ 291 if (typeof image_url === 'string') 292 _currentImageURL = image_url; 293 else if (typeof _currentImageURL !== 'string') 294 return; 295 let url = _currentImageURL.replace(/"/g, '%22'), 296 styles = '#image{background-image:url("'+url+'");background-size:'+settings.crop+'}'; 297 if (settings.crop === 'contain'){ 298 $imageGhost.css('opacity',''); 299 styles += '#image-ghost{display:block;background-image:url("'+url+'")}'; 300 } 301 302 $style.html(styles); 303 }
43 function setBackground(e) { 44 var myHTML = document.querySelector('html'); 45 myHTML.style.backgroundImage = "url('" + e.target.src + "')"; 46 }
29 function removeCss(document: Document, ref: number) { 30 if (injectedCache[ref] == null) { 31 return; 32 } 33 const head = getHead(document); 34 head.removeChild(injectedCache[ref]); 35 delete injectedCache[ref]; 36 }
91 function removeAllElementClass(className){ 92 $("."+className, window.parent.document).removeClass(className); 93 }
5 export function removeElement(domSelector) { 6 $(domSelector).remove(); 7 }
77 function calculateColorBackground(color) { 78 // Converts HEX to YIQ to judge what color background the color would look best on 79 color = color.replace(/[^0-9a-f]/gi, ''); 80 if (color.length < 6) { 81 color = color[0] + color[0] + color[1] + color[1] + color[2] + color[2]; 82 } 83 84 const r = parseInt(color.substr(0, 2), 16); 85 const g = parseInt(color.substr(2, 2), 16); 86 const b = parseInt(color.substr(4, 2), 16); 87 const yiq = ((r * 299) + (g * 587) + (b * 114)) / 1000; 88 return yiq >= 128 ? 'dark' : 'light'; 89 }