@zendesk/laika
Version:
Test, mock, intercept and modify Apollo Client's operations — in both browser and unit tests!
10 lines (9 loc) • 310 B
text/typescript
export const getLogStyle = (input: unknown) => {
const str = typeof input === 'string' ? input : '(anonymous)'
const hash = [...str].reduce(
(sum, letter) => sum + (letter.codePointAt(0) ?? 0),
0,
)
const hue = hash.toFixed(0)
return `color: hsl(${hue}, 70%, 70%); background-color: black`
}