UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

6 lines (5 loc) 957 B
/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.33/esri/copyright.txt for details. */ const t="theme-style";function e(t,e){return a(r(n(o(t),e)),e.size)}function n(e,{accentColor:n,contrastColor:o}){const r=n.toHex(),a=n.a,s=o.toHex(),i=o.a,c=e.getElementsByTagNameNS("http://www.w3.org/2000/svg","style").namedItem(t);return c&&(c.innerHTML=`\n .contrast-fill { fill: ${s}; fill-opacity: ${i}; }\n .contrast-stroke { stroke: ${s}; stroke-opacity: ${i}; }\n .accent-fill { fill: ${r}; fill-opacity: ${a}; }\n .accent-stroke { stroke: ${r}; stroke-opacity: ${a}; }`),e}function o(t){const e=t.split(",")[1],n=atob(e);return(new DOMParser).parseFromString(n,"image/svg+xml")}function r(t){const e=(new XMLSerializer).serializeToString(t);return`data:image/svg+xml;base64,${btoa(e)}`}function a(t,e){const n=new Image(e,e);return n.src=t,n}export{e as generateStyledTexture};