support overriding avatar background color from custom theme

This commit is contained in:
Bruno Windels 2020-04-27 19:38:27 +02:00
parent e8e99c2646
commit 1969310003

View file

@ -77,7 +77,9 @@ export function defaultAvatarUrlForString(s) {
}
const colorIndex = total % defaultColors.length;
// overwritten color value in custom themes
const color = defaultColors[colorIndex];
const cssVariable = `--avatar-background-colors_${colorIndex}`;
const cssValue = document.body.style.getPropertyValue(cssVariable);
const color = cssValue || defaultColors[colorIndex];
let dataUrl = colorToDataURLCache.get(color);
if (!dataUrl) {
dataUrl = urlForColor(color);