Sign in

Search issue titles and bodies, change requests and comments. Private repositories you cannot read are not included.

vole
Clone

Read only, no credentials:

https://rodent.software/vole.git

Write over SSH with a registered key:

git clone ssh://git@rodent.software:2222/vole.git

A free and open-source forge that lives in your Git repo.

Read the colour the browser actually resolved

aceaabbf44f3e20ab97e39c1de5047d11547a283 · Keenan Nemetz · 8d ago · parent 214145e5

Read the colour the browser actually resolved

The palette came out black-skied and oversaturated because the bundle read
every colour with "the first three numbers", and getComputedStyle
serializes a color-mix() result as color(srgb 0.571765 0.658824
0.461961). Those decimals contain digits, so the parser built
#00b36b600 — not a colour — for the sky and garbage for every hill.

Parse both forms the browser can return: rgb()/rgba() for a legacy sRGB
value and color(srgb r g b) with components in 0..1 for one that came
through color-mix(). Clamp, because color() components are floats.

Reproduced and checked in headless Chromium against a real instance, in
both themes and at both sizes, before and after: the fills are now
#bba575 / #9da9a0 / #886759 / #596855 / #445a52 on dark-medium and
#e7c76e / #f57d26 / #b6987a / #889371 / #6f8984 on light-medium.

server/web/static/dicebear-avatars.min.js +1−1

@@ -14,7 +14,7 @@
14 14 *
15 15 * Then run `vole workflow run verify` so the licence inventory is checked. */
16 16
17 "use strict";(()=>{function g(t){return t.replace(/&/g,"&amp;").replace(/'/g,"&apos;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function S(t){var e,r,o,n,a,l,d;let i=(e=t.meta)===null||e===void 0?void 0:e.title,s=(r=t.meta)===null||r===void 0?void 0:r.creator,u=(o=t.meta)===null||o===void 0?void 0:o.source,c=(a=(n=t.meta)===null||n===void 0?void 0:n.license)===null||a===void 0?void 0:a.url,m=P(t);return!i&&!s&&!u&&!c&&!m?"":'<metadata xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/"><rdf:RDF><rdf:Description>'+(i?`<dc:title>${g(i)}</dc:title>`:"")+(s?`<dc:creator>${g(s)}</dc:creator>`:"")+(u?`<dc:source xsi:type="dcterms:URI">${g((d=(l=t.meta)===null||l===void 0?void 0:l.source)!==null&&d!==void 0?d:"")}</dc:source>`:"")+(c?`<dcterms:license xsi:type="dcterms:URI">${g(c)}</dcterms:license>`:"")+(m?`<dc:rights>${g(m)}</dc:rights>`:"")+"</rdf:Description></rdf:RDF></metadata>"}function P(t){var e,r,o,n,a,l,d,i,s,u,c,m,y,$,f;let p=!((e=t.meta)===null||e===void 0)&&e.title?`\u201E${(r=t.meta)===null||r===void 0?void 0:r.title}\u201D`:"Design",O=`\u201E${(n=(o=t.meta)===null||o===void 0?void 0:o.creator)!==null&&n!==void 0?n:"Unknown"}\u201D`;!((a=t.meta)===null||a===void 0)&&a.source&&(p+=` (${t.meta.source})`);let b="";return((d=(l=t.meta)===null||l===void 0?void 0:l.license)===null||d===void 0?void 0:d.name)!=="MIT"&&((i=t.meta)===null||i===void 0?void 0:i.creator)!=="DiceBear"&&(!((s=t.meta)===null||s===void 0)&&s.title)&&(b+="Remix of "),b+=`${p} by ${O}`,!((c=(u=t.meta)===null||u===void 0?void 0:u.license)===null||c===void 0)&&c.name&&(b+=`, licensed under \u201E${(y=(m=t.meta)===null||m===void 0?void 0:m.license)===null||y===void 0?void 0:y.name}\u201D`,!((f=($=t.meta)===null||$===void 0?void 0:$.license)===null||f===void 0)&&f.url&&(b+=` (${t.meta.license.url})`)),b}function I(t){return t^=t<<13,t^=t>>17,t^=t<<5,t}function V(t){let e=0;for(let r=0;r<t.length;r++)e=(e<<5)-e+t.charCodeAt(r)|0,e=I(e);return e}function h(t=""){t=t.toString();let e=V(t)||1,r=()=>e=I(e),o=(n,a)=>Math.floor((r()- -2147483648)/4294967295*(a+1-n)+n);return{seed:t,next:r,bool(n=50){return o(1,100)<=n},integer(n,a){return o(n,a)},pick(n,a){var l;return n.length===0?(r(),a):(l=n[o(0,n.length-1)])!==null&&l!==void 0?l:a},shuffle(n){let a=h(r().toString()),l=[...n];for(let d=l.length-1;d>0;d--){let i=a.integer(0,d);[l[d],l[i]]=[l[i],l[d]]}return l},string(n,a="abcdefghijklmnopqrstuvwxyz1234567890"){let l=h(r().toString()),d="";for(let i=0;i<n;i++)d+=a[l.integer(0,a.length-1)];return d}}}function v(t){let e=t.attributes.viewBox.split(" "),r=parseInt(e[0]),o=parseInt(e[1]),n=parseInt(e[2]),a=parseInt(e[3]);return{x:r,y:o,width:n,height:a}}function A(t,e,r,o,n){let{width:a,height:l,x:d,y:i}=v(t),s=`<rect fill="${e}" width="${a}" height="${l}" x="${d}" y="${i}" />`;switch(o){case"solid":return s+t.body;case"gradientLinear":return`<rect fill="url(#backgroundLinear)" width="${a}" height="${l}" x="${d}" y="${i}" /><defs><linearGradient id="backgroundLinear" gradientTransform="rotate(${n} 0.5 0.5)"><stop stop-color="${e}"/><stop offset="1" stop-color="${r}"/></linearGradient></defs>`+t.body}}function M(t,e){let{width:r,height:o,x:n,y:a}=v(t),l=e?(e-100)/100:0,d=(r/2+n)*l*-1,i=(o/2+a)*l*-1;return`<g transform="translate(${d} ${i}) scale(${e/100})">${t.body}</g>`}function j(t,e,r){let o=v(t),n=(o.width+o.x*2)*((e??0)/100),a=(o.height+o.y*2)*((r??0)/100);return`<g transform="translate(${n} ${a})">${t.body}</g>`}function B(t,e){let{width:r,height:o,x:n,y:a}=v(t);return`<g transform="rotate(${e}, ${r/2+n}, ${o/2+a})">${t.body}</g>`}function R(t){let{width:e,x:r}=v(t);return`<g transform="scale(-1 1) translate(${e*-1-r*2} 0)">${t.body}</g>`}function U(t,e){let{width:r,height:o,x:n,y:a}=v(t),l=e?r*e/100:0,d=e?o*e/100:0;return`<mask id="viewboxMask"><rect width="${r}" height="${o}" rx="${l}" ry="${d}" x="${n}" y="${a}" fill="#fff" /></mask><g mask="url(#viewboxMask)">${t.body}</g>`}function z(t){let e={xmlns:"http://www.w3.org/2000/svg",...t.attributes};return Object.keys(e).map(r=>`${g(r)}="${g(e[r])}"`).join(" ")}function L(t){let e=h(Math.random().toString()),r={};return t.body.replace(/(id="|url\(#)([a-z0-9-_]+)([")])/gi,(o,n,a,l)=>(r[a]=r[a]||e.string(8),`${n}${r[a]}${l}`))}var N={type:"object",$schema:"http://json-schema.org/draft-07/schema#",properties:{seed:{type:"string"},flip:{type:"boolean",default:!1},rotate:{type:"integer",minimum:0,maximum:360,default:0},scale:{type:"integer",minimum:0,maximum:200,default:100},radius:{type:"integer",minimum:0,maximum:50,default:0},size:{type:"integer",minimum:1},backgroundColor:{type:"array",items:{type:"string",pattern:"^(transparent|[a-fA-F0-9]{6})$"}},backgroundType:{type:"array",items:{type:"string",enum:["solid","gradientLinear"]},default:["solid"]},backgroundRotation:{type:"array",items:{type:"integer",minimum:-360,maximum:360},default:[0,360]},translateX:{type:"integer",minimum:-100,maximum:100,default:0},translateY:{type:"integer",minimum:-100,maximum:100,default:0},clip:{type:"boolean",default:!0},randomizeIds:{type:"boolean",default:!1}}};function T(t){var e;let r={},o=(e=t.properties)!==null&&e!==void 0?e:{};return Object.keys(o).forEach(n=>{let a=o[n];typeof a=="object"&&a.default!==void 0&&(Array.isArray(a.default)?r[n]=[...a.default]:typeof a.default=="object"?r[n]={...a.default}:r[n]=a.default)}),r}function X(t,e){var r;let o={...T(N),...T((r=t.schema)!==null&&r!==void 0?r:{}),...e};return JSON.parse(JSON.stringify(o))}function D(t){return t==="transparent"?t:`#${t}`}function E(t,e,r){var o;let n=t.shuffle(e);n.length<=1||e.length==2&&r=="gradientLinear"?(n=e,t.next()):n=t.shuffle(e),n.length===0&&(n=["transparent"]);let a=n[0],l=(o=n[1])!==null&&o!==void 0?o:n[0];return{primary:D(a),secondary:D(l)}}function q(t,e={}){var r,o,n,a,l;e=X(t,e);let d=h(e.seed),i=t.create({prng:d,options:e}),s=d.pick((r=e.backgroundType)!==null&&r!==void 0?r:[],"solid"),{primary:u,secondary:c}=E(d,(o=e.backgroundColor)!==null&&o!==void 0?o:[],s),m=d.integer(!((n=e.backgroundRotation)===null||n===void 0)&&n.length?Math.min(...e.backgroundRotation):0,!((a=e.backgroundRotation)===null||a===void 0)&&a.length?Math.max(...e.backgroundRotation):0);e.size&&(i.attributes.width=e.size.toString(),i.attributes.height=e.size.toString()),e.scale!==void 0&&e.scale!==100&&(i.body=M(i,e.scale)),e.flip&&(i.body=R(i)),e.rotate&&(i.body=B(i,e.rotate)),(e.translateX||e.translateY)&&(i.body=j(i,e.translateX,e.translateY)),u!=="transparent"&&c!=="transparent"&&(i.body=A(i,u,c,s,m)),(e.radius||e.clip)&&(i.body=U(i,(l=e.radius)!==null&&l!==void 0?l:0)),e.randomizeIds&&(i.body=L(i));let y=z(i),$=S(t),f=`<svg ${y}>${$}${i.body}</svg>`;return{toString:()=>f,toJson:()=>{var p;return{svg:f,extra:{primaryBackgroundColor:u,secondaryBackgroundColor:c,backgroundType:s,backgroundRotation:m,...(p=i.extra)===null||p===void 0?void 0:p.call(i)}}},toDataUri:()=>`data:image/svg+xml;utf8,${encodeURIComponent(f)}`}}var J=[.4,.56,.68],G=(t,e,r)=>{let o=parseInt(t,16),n=parseInt(r,16),a=l=>{let d=o>>l&255,i=n>>l&255;return Math.round(d+(i-d)*e).toString(16).padStart(2,"0")};return a(16)+a(8)+a(0)},H={meta:{title:"Landscape",source:"https://github.com/rodent-software/vole",creator:"Vole",license:{name:"Apache-2.0",url:"https://www.apache.org/licenses/LICENSE-2.0"}},schema:{type:"object",properties:{skyColor:{type:"array",items:{type:"string"},default:["6b7561"]},palette:{type:"array",items:{type:"string"},default:[]},ink:{type:"string",default:"272e33"},discColor:{type:"array",items:{type:"string"},default:["f0e6d2"]},hillCount:{type:"array",items:{type:"integer",minimum:2,maximum:3},default:[2,3]}}},create({prng:t,options:e}){let r=t.pick(e.skyColor??["6b7561"],"6b7561"),o=e.ink??"272e33",n=e.discColor??["f0e6d2"],a=t.pick(e.hillCount??[2,3],2),l=[`<rect width="100" height="100" fill="#${r}"/>`],d=(e.palette??[]).filter(i=>i&&i!==r);for(let i=d.length-1;i>0;i--){let s=t.integer(0,i);[d[i],d[s]]=[d[s],d[i]]}l.push(`<circle cx="${t.integer(16,84)}" cy="${t.integer(18,32)}" r="${t.integer(6,10)}" fill="#${t.pick(n)}"/>`);for(let i=0;i<a;i++){let s=t.integer(70,130),u=t.integer(40,66)-i*t.integer(5,10),c=d.length?d[i%d.length]:r;l.push(`<circle cx="${t.integer(-20,120)}" cy="${100+s-u}" r="${s}" fill="#${G(c,J[i],o)}"/>`)}return{attributes:{viewBox:"0 0 100 100"},body:l.join("")}}},x,k=t=>{x||(x=document.createElement("span"),x.hidden=!0,document.body.appendChild(x)),x.style.color=`var(${t})`;let e=(getComputedStyle(x).color.match(/\d+/g)||[]).map(Number);return e.length<3?"":e.slice(0,3).map(r=>r.toString(16).padStart(2,"0")).join("")},w={theme:null,palette:[],ink:"",discs:[]},K=()=>{let t=document.documentElement.getAttribute("data-theme")||"";if(w.theme===t)return w;let e=[];for(let r=1;r<=7;r++){let o=k(`--av-c${r}`);o&&e.push(o)}return w={theme:t,palette:e,ink:k("--av-ink")||"272e33",discs:[k("--av-disc-1"),k("--av-disc-2"),k("--av-disc-3")].filter(Boolean)},w},Q=t=>{let e=(getComputedStyle(t).backgroundColor.match(/\d+/g)||[]).map(Number);return e.length<3?"":e.slice(0,3).map(r=>r.toString(16).padStart(2,"0")).join("")},F=t=>{if(t.querySelector("svg"))return;let e=t.getAttribute("data-avatar");if(!e)return;let r=Q(t),o=K(),n=q(H,{seed:e,size:40,clip:!1,backgroundColor:[],skyColor:r?[r]:void 0,palette:o.palette,ink:o.ink,discColor:o.discs.length?o.discs:void 0,hillCount:[2,3]}).toString();t.innerHTML=n.replace(/<metadata[\s\S]*?<\/metadata>/g,"")};window.VoleAvatars={render:F,renderAll(t){t.querySelectorAll("[data-avatar]").forEach(F)}};})();
17 "use strict";(()=>{function g(t){return t.replace(/&/g,"&amp;").replace(/'/g,"&apos;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function S(t){var e,r,i,n,a,l,s;let o=(e=t.meta)===null||e===void 0?void 0:e.title,d=(r=t.meta)===null||r===void 0?void 0:r.creator,u=(i=t.meta)===null||i===void 0?void 0:i.source,c=(a=(n=t.meta)===null||n===void 0?void 0:n.license)===null||a===void 0?void 0:a.url,m=V(t);return!o&&!d&&!u&&!c&&!m?"":'<metadata xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/"><rdf:RDF><rdf:Description>'+(o?`<dc:title>${g(o)}</dc:title>`:"")+(d?`<dc:creator>${g(d)}</dc:creator>`:"")+(u?`<dc:source xsi:type="dcterms:URI">${g((s=(l=t.meta)===null||l===void 0?void 0:l.source)!==null&&s!==void 0?s:"")}</dc:source>`:"")+(c?`<dcterms:license xsi:type="dcterms:URI">${g(c)}</dcterms:license>`:"")+(m?`<dc:rights>${g(m)}</dc:rights>`:"")+"</rdf:Description></rdf:RDF></metadata>"}function V(t){var e,r,i,n,a,l,s,o,d,u,c,m,y,b,f;let p=!((e=t.meta)===null||e===void 0)&&e.title?`\u201E${(r=t.meta)===null||r===void 0?void 0:r.title}\u201D`:"Design",P=`\u201E${(n=(i=t.meta)===null||i===void 0?void 0:i.creator)!==null&&n!==void 0?n:"Unknown"}\u201D`;!((a=t.meta)===null||a===void 0)&&a.source&&(p+=` (${t.meta.source})`);let $="";return((s=(l=t.meta)===null||l===void 0?void 0:l.license)===null||s===void 0?void 0:s.name)!=="MIT"&&((o=t.meta)===null||o===void 0?void 0:o.creator)!=="DiceBear"&&(!((d=t.meta)===null||d===void 0)&&d.title)&&($+="Remix of "),$+=`${p} by ${P}`,!((c=(u=t.meta)===null||u===void 0?void 0:u.license)===null||c===void 0)&&c.name&&($+=`, licensed under \u201E${(y=(m=t.meta)===null||m===void 0?void 0:m.license)===null||y===void 0?void 0:y.name}\u201D`,!((f=(b=t.meta)===null||b===void 0?void 0:b.license)===null||f===void 0)&&f.url&&($+=` (${t.meta.license.url})`)),$}function C(t){return t^=t<<13,t^=t>>17,t^=t<<5,t}function Y(t){let e=0;for(let r=0;r<t.length;r++)e=(e<<5)-e+t.charCodeAt(r)|0,e=C(e);return e}function h(t=""){t=t.toString();let e=Y(t)||1,r=()=>e=C(e),i=(n,a)=>Math.floor((r()- -2147483648)/4294967295*(a+1-n)+n);return{seed:t,next:r,bool(n=50){return i(1,100)<=n},integer(n,a){return i(n,a)},pick(n,a){var l;return n.length===0?(r(),a):(l=n[i(0,n.length-1)])!==null&&l!==void 0?l:a},shuffle(n){let a=h(r().toString()),l=[...n];for(let s=l.length-1;s>0;s--){let o=a.integer(0,s);[l[s],l[o]]=[l[o],l[s]]}return l},string(n,a="abcdefghijklmnopqrstuvwxyz1234567890"){let l=h(r().toString()),s="";for(let o=0;o<n;o++)s+=a[l.integer(0,a.length-1)];return s}}}function v(t){let e=t.attributes.viewBox.split(" "),r=parseInt(e[0]),i=parseInt(e[1]),n=parseInt(e[2]),a=parseInt(e[3]);return{x:r,y:i,width:n,height:a}}function I(t,e,r,i,n){let{width:a,height:l,x:s,y:o}=v(t),d=`<rect fill="${e}" width="${a}" height="${l}" x="${s}" y="${o}" />`;switch(i){case"solid":return d+t.body;case"gradientLinear":return`<rect fill="url(#backgroundLinear)" width="${a}" height="${l}" x="${s}" y="${o}" /><defs><linearGradient id="backgroundLinear" gradientTransform="rotate(${n} 0.5 0.5)"><stop stop-color="${e}"/><stop offset="1" stop-color="${r}"/></linearGradient></defs>`+t.body}}function A(t,e){let{width:r,height:i,x:n,y:a}=v(t),l=e?(e-100)/100:0,s=(r/2+n)*l*-1,o=(i/2+a)*l*-1;return`<g transform="translate(${s} ${o}) scale(${e/100})">${t.body}</g>`}function B(t,e,r){let i=v(t),n=(i.width+i.x*2)*((e??0)/100),a=(i.height+i.y*2)*((r??0)/100);return`<g transform="translate(${n} ${a})">${t.body}</g>`}function j(t,e){let{width:r,height:i,x:n,y:a}=v(t);return`<g transform="rotate(${e}, ${r/2+n}, ${i/2+a})">${t.body}</g>`}function R(t){let{width:e,x:r}=v(t);return`<g transform="scale(-1 1) translate(${e*-1-r*2} 0)">${t.body}</g>`}function U(t,e){let{width:r,height:i,x:n,y:a}=v(t),l=e?r*e/100:0,s=e?i*e/100:0;return`<mask id="viewboxMask"><rect width="${r}" height="${i}" rx="${l}" ry="${s}" x="${n}" y="${a}" fill="#fff" /></mask><g mask="url(#viewboxMask)">${t.body}</g>`}function z(t){let e={xmlns:"http://www.w3.org/2000/svg",...t.attributes};return Object.keys(e).map(r=>`${g(r)}="${g(e[r])}"`).join(" ")}function L(t){let e=h(Math.random().toString()),r={};return t.body.replace(/(id="|url\(#)([a-z0-9-_]+)([")])/gi,(i,n,a,l)=>(r[a]=r[a]||e.string(8),`${n}${r[a]}${l}`))}var T={type:"object",$schema:"http://json-schema.org/draft-07/schema#",properties:{seed:{type:"string"},flip:{type:"boolean",default:!1},rotate:{type:"integer",minimum:0,maximum:360,default:0},scale:{type:"integer",minimum:0,maximum:200,default:100},radius:{type:"integer",minimum:0,maximum:50,default:0},size:{type:"integer",minimum:1},backgroundColor:{type:"array",items:{type:"string",pattern:"^(transparent|[a-fA-F0-9]{6})$"}},backgroundType:{type:"array",items:{type:"string",enum:["solid","gradientLinear"]},default:["solid"]},backgroundRotation:{type:"array",items:{type:"integer",minimum:-360,maximum:360},default:[0,360]},translateX:{type:"integer",minimum:-100,maximum:100,default:0},translateY:{type:"integer",minimum:-100,maximum:100,default:0},clip:{type:"boolean",default:!0},randomizeIds:{type:"boolean",default:!1}}};function X(t){var e;let r={},i=(e=t.properties)!==null&&e!==void 0?e:{};return Object.keys(i).forEach(n=>{let a=i[n];typeof a=="object"&&a.default!==void 0&&(Array.isArray(a.default)?r[n]=[...a.default]:typeof a.default=="object"?r[n]={...a.default}:r[n]=a.default)}),r}function D(t,e){var r;let i={...X(T),...X((r=t.schema)!==null&&r!==void 0?r:{}),...e};return JSON.parse(JSON.stringify(i))}function N(t){return t==="transparent"?t:`#${t}`}function E(t,e,r){var i;let n=t.shuffle(e);n.length<=1||e.length==2&&r=="gradientLinear"?(n=e,t.next()):n=t.shuffle(e),n.length===0&&(n=["transparent"]);let a=n[0],l=(i=n[1])!==null&&i!==void 0?i:n[0];return{primary:N(a),secondary:N(l)}}function F(t,e={}){var r,i,n,a,l;e=D(t,e);let s=h(e.seed),o=t.create({prng:s,options:e}),d=s.pick((r=e.backgroundType)!==null&&r!==void 0?r:[],"solid"),{primary:u,secondary:c}=E(s,(i=e.backgroundColor)!==null&&i!==void 0?i:[],d),m=s.integer(!((n=e.backgroundRotation)===null||n===void 0)&&n.length?Math.min(...e.backgroundRotation):0,!((a=e.backgroundRotation)===null||a===void 0)&&a.length?Math.max(...e.backgroundRotation):0);e.size&&(o.attributes.width=e.size.toString(),o.attributes.height=e.size.toString()),e.scale!==void 0&&e.scale!==100&&(o.body=A(o,e.scale)),e.flip&&(o.body=R(o)),e.rotate&&(o.body=j(o,e.rotate)),(e.translateX||e.translateY)&&(o.body=B(o,e.translateX,e.translateY)),u!=="transparent"&&c!=="transparent"&&(o.body=I(o,u,c,d,m)),(e.radius||e.clip)&&(o.body=U(o,(l=e.radius)!==null&&l!==void 0?l:0)),e.randomizeIds&&(o.body=L(o));let y=z(o),b=S(t),f=`<svg ${y}>${b}${o.body}</svg>`;return{toString:()=>f,toJson:()=>{var p;return{svg:f,extra:{primaryBackgroundColor:u,secondaryBackgroundColor:c,backgroundType:d,backgroundRotation:m,...(p=o.extra)===null||p===void 0?void 0:p.call(o)}}},toDataUri:()=>`data:image/svg+xml;utf8,${encodeURIComponent(f)}`}}var G=[.4,.56,.68],H=(t,e,r)=>{let i=parseInt(t,16),n=parseInt(r,16),a=l=>{let s=i>>l&255,o=n>>l&255;return Math.round(s+(o-s)*e).toString(16).padStart(2,"0")};return a(16)+a(8)+a(0)},K={meta:{title:"Landscape",source:"https://github.com/rodent-software/vole",creator:"Vole",license:{name:"Apache-2.0",url:"https://www.apache.org/licenses/LICENSE-2.0"}},schema:{type:"object",properties:{skyColor:{type:"array",items:{type:"string"},default:["6b7561"]},palette:{type:"array",items:{type:"string"},default:[]},ink:{type:"string",default:"272e33"},discColor:{type:"array",items:{type:"string"},default:["f0e6d2"]},hillCount:{type:"array",items:{type:"integer",minimum:2,maximum:3},default:[2,3]}}},create({prng:t,options:e}){let r=t.pick(e.skyColor??["6b7561"],"6b7561"),i=e.ink??"272e33",n=e.discColor??["f0e6d2"],a=t.pick(e.hillCount??[2,3],2),l=[`<rect width="100" height="100" fill="#${r}"/>`],s=(e.palette??[]).filter(o=>o&&o!==r);for(let o=s.length-1;o>0;o--){let d=t.integer(0,o);[s[o],s[d]]=[s[d],s[o]]}l.push(`<circle cx="${t.integer(16,84)}" cy="${t.integer(18,32)}" r="${t.integer(6,10)}" fill="#${t.pick(n)}"/>`);for(let o=0;o<a;o++){let d=t.integer(70,130),u=t.integer(40,66)-o*t.integer(5,10),c=s.length?s[o%s.length]:r;l.push(`<circle cx="${t.integer(-20,120)}" cy="${100+d-u}" r="${d}" fill="#${H(c,G[o],i)}"/>`)}return{attributes:{viewBox:"0 0 100 100"},body:l.join("")}}},O=t=>{let e=t.trim(),r=/^color\(srgb\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)/.exec(e);if(r)return[1,2,3].map(n=>Math.round(Math.min(1,Math.max(0,parseFloat(r[n])))*255)).map(n=>n.toString(16).padStart(2,"0")).join("");let i=/^rgba?\(([^)]+)\)/.exec(e);if(i){let n=i[1].split(/[\s,/]+/).filter(Boolean).map(Number);if(n.length>=3)return n.slice(0,3).map(a=>Math.round(Math.min(255,Math.max(0,a)))).map(a=>a.toString(16).padStart(2,"0")).join("")}return""},x,k=t=>(x||(x=document.createElement("span"),x.hidden=!0,document.body.appendChild(x)),x.style.color=`var(${t})`,O(getComputedStyle(x).color)),w={theme:null,palette:[],ink:"",discs:[]},Q=()=>{let t=document.documentElement.getAttribute("data-theme")||"";if(w.theme===t)return w;let e=[];for(let r=1;r<=7;r++){let i=k(`--av-c${r}`);i&&e.push(i)}return w={theme:t,palette:e,ink:k("--av-ink")||"272e33",discs:[k("--av-disc-1"),k("--av-disc-2"),k("--av-disc-3")].filter(Boolean)},w},W=t=>O(getComputedStyle(t).backgroundColor),q=t=>{if(t.querySelector("svg"))return;let e=t.getAttribute("data-avatar");if(!e)return;let r=W(t),i=Q(),n=F(K,{seed:e,size:40,clip:!1,backgroundColor:[],skyColor:r?[r]:void 0,palette:i.palette,ink:i.ink,discColor:i.discs.length?i.discs:void 0,hillCount:[2,3]}).toString();t.innerHTML=n.replace(/<metadata[\s\S]*?<\/metadata>/g,"")};window.VoleAvatars={render:q,renderAll(t){t.querySelectorAll("[data-avatar]").forEach(q)}};})();
18 18 /*! Vole avatars: a landscape drawn by DiceBear core 9.3.1.
19 19 *
20 20 * DiceBear is MIT (see server/web/static/dicebear.LICENSE); the Landscape style