Skip to content

Commit

Permalink
Merge pull request #534 from tchapgouv/task/fix-room-avatars-default-…
Browse files Browse the repository at this point in the history
…colors

Room avatars take default colors
  • Loading branch information
odelcroi authored Apr 14, 2023
2 parents 6f62e15 + bb7f942 commit 1aad5ab
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
12 changes: 10 additions & 2 deletions patches/patches.json
Original file line number Diff line number Diff line change
Expand Up @@ -206,5 +206,13 @@
"files": [
"src/stores/RoomViewStore.tsx"
]
}
}
},
"room-avatars-default-colors": {
"github-issue": "https://github.com/tchapgouv/tchap-web-v4/issues/282",
"package": "matrix-react-sdk",
"files": [
"src/Avatar.ts"
]
}

}
13 changes: 13 additions & 0 deletions patches/room-avatars-default-colors/matrix-react-sdk+3.69.1.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/node_modules/matrix-react-sdk/src/Avatar.ts b/node_modules/matrix-react-sdk/src/Avatar.ts
index 88c80ef..a023ba0 100644
--- a/node_modules/matrix-react-sdk/src/Avatar.ts
+++ b/node_modules/matrix-react-sdk/src/Avatar.ts
@@ -96,7 +96,7 @@ export function defaultAvatarUrlForString(s: string): string {
const colorIndex = total % defaultColors.length;
// overwritten color value in custom themes
const cssVariable = `--avatar-background-colors_${colorIndex}`;
- const cssValue = document.body.style.getPropertyValue(cssVariable);
+ const cssValue = getComputedStyle(document.body).getPropertyValue(cssVariable);
const color = cssValue || defaultColors[colorIndex];
let dataUrl = colorToDataURLCache.get(color);
if (!dataUrl) {

0 comments on commit 1aad5ab

Please sign in to comment.