Skip transparent background for cursor (#1208)

* Skip transparent background for cursor

* slice
This commit is contained in:
Lipis 2020-04-04 00:54:04 +03:00 committed by GitHub
parent 3afb4515b6
commit 31f76d59a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -22,9 +22,13 @@ type HandlerRectanglesRet = keyof ReturnType<typeof handlerRectangles>;
function colorsForClientId(clientId: string) {
// Naive way of getting an integer out of the clientId
const sum = clientId.split("").reduce((a, str) => a + str.charCodeAt(0), 0);
// Skip transparent background.
const backgrounds = colors.elementBackground.slice(1);
const strokes = colors.elementStroke.slice(1);
return {
background: colors.elementBackground[sum % colors.elementBackground.length],
stroke: colors.elementStroke[sum % colors.elementBackground.length],
background: backgrounds[sum % backgrounds.length],
stroke: strokes[sum % strokes.length],
};
}