UNPKG

@nuxt/devtools-ui-kit

Version:

<a href="https://www.npmjs.com/package/@nuxt/devtools-ui-kit"><img src="https://flat.badgen.net/npm/v/@nuxt/devtools-ui-kit"></a>

8 lines (7 loc) 298 B
export function getHslColorFromStringHash(name, saturation = 65, lightness = 50, opacity = 1) { let hash = 0; for (let i = 0; i < name.length; i++) hash = name.charCodeAt(i) + ((hash << 5) - hash); const h = hash % 360; return `hsla(${h}, ${saturation}%, ${lightness}%, ${opacity})`; }