Add API for propagating cursor locations (#61)
This commit is contained in:
parent
f97193e287
commit
e8b9bf40c5
1 changed files with 1929 additions and 2228 deletions
9
frontend/obsidian-plugin/src/utils/get-random-color.ts
Normal file
9
frontend/obsidian-plugin/src/utils/get-random-color.ts
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
export function getRandomColor(name: string): string {
|
||||
let hash = 0;
|
||||
for (let i = 0; i < name.length; i++) {
|
||||
hash = (hash << 5) - hash + name.charCodeAt(i);
|
||||
hash |= 0; // Convert to 32bit integer
|
||||
}
|
||||
const normalised = hash / 0x7fffffff;
|
||||
return `hsl(${Math.abs(normalised * 360)}, 55%, 55%)`; // HSL color
|
||||
}
|
||||
Loading…
Reference in a new issue