You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2 lines
1.5 KiB
2 lines
1.5 KiB
function r(r,o){let t=r.replace("#","").trim();if(3===t.length&&(t=t.split("").map(r=>r+r).join("")),6!==t.length)return`rgba(5, 201, 172, ${o})`;const n=parseInt(t,16);return`rgba(${n>>16&255},${n>>8&255},${255&n},${o})`}function o(r){let o=(r||"#05c9ac").trim();o.startsWith("#")||(o=`#${o}`);const t=o.match(/^#([0-9a-f]{3}|[0-9a-f]{6})$/i);if(!t)return"#05c9ac";let n=t[1];return 3===n.length&&(n=`${n[0]}${n[0]}${n[1]}${n[1]}${n[2]}${n[2]}`),`#${n.toLowerCase()}`}function t(r,o){const t=null==o?void 0:o.find(o=>o.value===r);return(null==t?void 0:t.color)||"#05c9ac"}function n(t){const n=o(t);return{color:n,backgroundColor:r(n,.14)}}function c(t,n){const c=Array.isArray(n)?n:[];if(!c.length)return{color:"#2c2c2c",backgroundColor:"rgba(5, 201, 172, 0.14)"};const a=c[Math.max(0,Math.floor(Number(t))||0)%c.length],l=o(a.color&&String(a.color).trim()||"#05c9ac");return{color:l,backgroundColor:r(l,.14)}}const a=["#05c9ac","#0d9b8a","#126794","#1ec8ae","#0a826f","#2db5a2"];function l(t,n){const c=t&&String(t).trim()||"";if(!c)return{color:"#0a826f",backgroundColor:"rgba(5, 201, 172, 0.12)"};const l=Array.isArray(n)?n:[],e=l.findIndex(r=>r.value===c);if(e>=0){const t=l[e],n=t.color&&String(t.color).trim();if(n){const t=o(n);return{color:t,backgroundColor:r(t,.14)}}const c=o(a[e%a.length]);return{color:c,backgroundColor:r(c,.12)}}const u=o(a[function(r){let o=0;for(let t=0;t<r.length;t+=1)o=Math.imul(31,o)+r.charCodeAt(t)|0;return Math.abs(o)}(c)%a.length]);return{color:u,backgroundColor:r(u,.12)}}export{c as a,t as c,l as o,n as v};
|