PageSourceSearch

https://cansonic.com/cdn/shop/t/17/assets/swatch-colors.js?v=113331978422415583671716170778

js cansonic.com collected 2026-10-04 07:46:19 UTC 1,823 bytes, 2 lines download raw bytes

1function getColorBrightness(rgbColor){var colorValues=rgbColor.match(/[\d\.]+/g).map(Number);return .2126*(colorValues[0]/255)+.7152*(colorValues[1]/255)+.0722*(colorValues[2]/255)}function isSimilarToBackground(color){var backgroundColor="rgb(255, 255, 255)",colorBrightness=getColorBrightness(color),backgroundColorBrightness=getColorBrightness(backgroundColor);return backgroundColorBrightness/colorBrightness<1.5}var SwatchColors=(function(){function SwatchColors2(){this.colors={},this.images={},this.triggers=["color","colour","couleur","farbe","cor"]}function setSwatchColor(swatch){var swatchId=swatch.getAttribute("swatch-id");Object.keys(this.colors).includes(swatchId)&&(swatch.style.setProperty("--background-graphic",this.colors[swatchId]),isSimilarToBackground(this.colors[swatchId])&&swatch.classList.add("is-similar-to-background"),getColorBrightness(this.colors[swatchId])>.5?swatch.style.setProperty("--tick-color","#000"):swatch.style.setProperty("--tick-color","#fff"),swatch.classList.remove("is-blank")),Object.keys(this.images).includes(swatchId)&&(swatch.style.setProperty("--background-graphic",this.images[swatchId]),swatch.classList.add("is-image"),swatch.classList.remove("is-blank"))}return SwatchColors2.prototype.setSwatchColor=setSwatchColor,SwatchColors2})();window.theme.swatches=new SwatchColors;function VariantSwatch(){return Reflect.construct(HTMLElement,[],this.constructor)}VariantSwatch.prototype=Object.create(HTMLElement.prototype),VariantSwatch.prototype.constructor=VariantSwatch,Object.setPrototypeOf(VariantSwatch,HTMLElement),VariantSwatch.prototype.connectedCallback=function(){window.theme.swatches.setSwatchColor(this)},customElements.define("variant-swatch",VariantSwatch);
2//# sourceMappingURL=/cdn/shop/t/17/assets/swatch-colors.js.map?v=113331978422415583671716170778

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.