(str: string, saturation: number = 70, lightness: number = 60)
| 119 | * Generate unique color from string hash using HSL |
| 120 | */ |
| 121 | export function colorFromString(str: string, saturation: number = 70, lightness: number = 60): string { |
| 122 | let hash = 0; |
| 123 | for (let i = 0; i < str.length; i++) { |
| 124 | hash = str.charCodeAt(i) + ((hash << 5) - hash); |
| 125 | } |
| 126 | const hue = Math.abs(hash) % 360; |
| 127 | return `hsl(${hue}, ${saturation}%, ${lightness}%)`; |
| 128 | } |
| 129 | |
| 130 | /** |
| 131 | * Get node or collapsed group representation for edge routing |
no outgoing calls
no test coverage detected