1function getAccentHex(string) { 2 if (string.indexOf("light-accent") > -1) { 3 return "#FFFFFF"; 4 } 5 else if (string.indexOf("dark-accent") > -1) { 6 return "#000000"; 7 } 8 else { 9 if (!!_VARIABLES && !!_VARIABLES["primary-color"]) { 10 if (string.indexOf("primary-accent") > -1) { 11 return _VARIABLES["primary-color"]; 12 } 13 else if (string.indexOf("secondary-accent") > -1) { 14 return _VARIABLES["secondary-color"]; 15 } 16 else if (string.indexOf("tertiary-accent") > -1) { 17 return _VARIABLES["tertiary-color"]; 18 } 19 } 20 } 21 return null; 22} 23 24function setTextColor(color) { 25 var hslColor = hexToHSL(color); 26 if (hslColor.l > 50) { 27 return "black"; 28 } 29 else { 30 return "white"; 31 } 32} 33 34function hexToHSL(hex) { 35 var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); 36 37 var r = parseInt(result[1], 16); 38 var g = parseInt(result[2], 16); 39 var b = parseInt(result[3], 16); 40 41 r /= 255, g /= 255, b /= 255; 42 var max = Math.max(r, g, b), min = Math.min(r, g, b); 43 var h, s, l = (max + min) / 2; 44 45 if(max == min){ 46 h = s = 0; // achromatic 47 } else { 48 var d = max - min; 49 s = l > 0.5 ? d / (2 - max - min) : d / (max + min); 50 switch(max) { 51 case r: h = (g - b) / d + (g < b ? 6 : 0); break; 52 case g: h = (b - r) / d + 2; break; 53 case b: h = (r - g) / d + 4; break; 54 } 55 h /= 6; 56 } 57 58 s = s*100; 59 s = Math.round(s); 60 l = l*100; 61 l = Math.round(l); 62 h = Math.round(360*h); 63 64 var colorInHSL = { 65 h: h, 66 s: s, 67 l: l 68 }; 69 70 // I think this HSL may be wrong??? Seems like the Hue is off 71 return colorInHSL; 72}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.