UNPKG

@bothub-chat/ui

Version:

Bothub UI Components

2 lines (1 loc) 256 B
const t=t=>{const[a,n,o]=t.map(t=>t/255),r=Math.max(a,n,o),e=r-Math.min(a,n,o);let h;h=0===e?0:r===a?(n-o)/e%6:r===n?(o-a)/e+2:(a-n)/e+4,h=Math.round(60*h),h<0&&(h+=360);return[h,0===r?0:Math.round(e/r*1e3)/10,Math.round(1e3*r)/10]};export{t as rgbToHsv};