You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-08 21:42:24 +03:00
support overriding avatar background color from custom theme
This commit is contained in:
@@ -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);
|
||||||
|
|||||||
Reference in New Issue
Block a user