support overriding avatar background color from custom theme
This commit is contained in:
parent
e8e99c2646
commit
1969310003
1 changed files with 3 additions and 1 deletions
|
@ -77,7 +77,9 @@ export function defaultAvatarUrlForString(s) {
|
||||||
}
|
}
|
||||||
const colorIndex = total % defaultColors.length;
|
const colorIndex = total % defaultColors.length;
|
||||||
// overwritten color value in custom themes
|
// 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);
|
let dataUrl = colorToDataURLCache.get(color);
|
||||||
if (!dataUrl) {
|
if (!dataUrl) {
|
||||||
dataUrl = urlForColor(color);
|
dataUrl = urlForColor(color);
|
||||||
|
|
Loading…
Reference in a new issue