mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
feat: allow host to pass color for collaborators (#2943)
* feat: allow host to pass color for collaborators * remove user prop as its not used anywhere * update changelog and readme * add pr link
This commit is contained in:
parent
86222662f2
commit
e63a0ec5be
8 changed files with 19 additions and 20 deletions
|
@ -1,6 +1,13 @@
|
|||
import colors from "./colors";
|
||||
import { AppState } from "./types";
|
||||
|
||||
export const getClientColors = (clientId: string) => {
|
||||
export const getClientColors = (clientId: string, appState: AppState) => {
|
||||
if (appState?.collaborators) {
|
||||
const currentUser = appState.collaborators.get(clientId);
|
||||
if (currentUser?.color) {
|
||||
return currentUser.color;
|
||||
}
|
||||
}
|
||||
// Naive way of getting an integer out of the clientId
|
||||
const sum = clientId.split("").reduce((a, str) => a + str.charCodeAt(0), 0);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue