MCPcopy Create free account
hub / github.com/codag-megalith/codag-visualizer / colorFromString

Function colorFromString

frontend/src/webview-client/utils.ts:121–128  ·  view source on GitHub ↗
(str: string, saturation: number = 70, lightness: number = 60)

Source from the content-addressed store, hash-verified

119 * Generate unique color from string hash using HSL
120 */
121export 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

Callers 3

detectWorkflowGroupsFunction · 0.90
renderNodesFunction · 0.90
createNodeElementFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected