Skip to content

Instantly share code, notes, and snippets.

@bundle-js
Created October 31, 2023 18:52
Show Gist options
  • Save bundle-js/3a0ba85fe952eeb56727ff1378708de2 to your computer and use it in GitHub Desktop.
Save bundle-js/3a0ba85fe952eeb56727ff1378708de2 to your computer and use it in GitHub Desktop.
function h(o){let t=g(o);return function(){let r=t[0]^t[0]<<11;return t[0]=t[1],t[1]=t[2],t[2]=t[3],t[3]=t[3]^t[3]>>19^r^r>>8,(t[3]>>>0)/(1<<31>>>0)}}function g(o){let t=new Uint32Array([0,0,0,0]);for(let r=0;r<o.length;r++)t[r%4]=(t[r%4]<<5)-t[r%4]+o.charCodeAt(r);return t}function w(o){let t=h(o.toLowerCase()),r=$(t);return[p(t),r]}function p(o){let t=new Uint8Array(32);for(let r=0;r<32;r++)t[r]=Math.floor(o()*2.3);return t}function $(o){let t=l(o),r=l(o),n=l(o);return[r,t,n]}function l(o){return new Uint16Array([o()*360,40+o()*60,(o()+o()+o()+o())*25])}var d='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 8 8" shape-rendering="optimizeSpeed" ';function v(o,t){let r=h(o.toLowerCase()),[n,s,a]=$(r),e=["M0,0H8V8H0z","",""];for(let i=0,f,u;i<32;i++){f=i%4,u=Math.floor(i/4);let c=Math.floor(r()*2.3);c>0&&(e[c]+=`M${f},${u}h1v1h-1zM${7-f},${u}h1v1h-1z`)}return`${d}width="${t}" height="${t}"><path fill="hsl(${n[0]} ${n[1]}% ${n[2]}%)" d="${e[0]}"/><path fill="hsl(${s[0]} ${s[1]}% ${s[2]}%)" d="${e[1]}"/><path fill="hsl(${a[0]} ${a[1]}% ${a[2]}%)" d="${e[2]}"/></svg>`}function x(o,t=64){return"data:image/svg+xml;base64,"+btoa(m(o,t))}function m(o,t=64){return v(o,t)}function b(o){return w(o)}export{x as blo,b as bloImage,m as bloSvg};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment