aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/shared-actor-image/actor-avatar.component.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-02-28 16:44:11 +0100
committerChocobozzz <me@florianbigard.com>2022-02-28 16:44:11 +0100
commitf41efa52a412272928ba90e06c9a9a9c471d1ca3 (patch)
tree013750584908d5da554712f50124720d21f750e3 /client/src/app/shared/shared-actor-image/actor-avatar.component.ts
parentfbd573e59cb8d96edb79663a2cd3696be00b23ad (diff)
downloadPeerTube-f41efa52a412272928ba90e06c9a9a9c471d1ca3.tar.gz
PeerTube-f41efa52a412272928ba90e06c9a9a9c471d1ca3.tar.zst
PeerTube-f41efa52a412272928ba90e06c9a9a9c471d1ca3.zip
Fix avatar with username starting with numbers
Diffstat (limited to 'client/src/app/shared/shared-actor-image/actor-avatar.component.ts')
-rw-r--r--client/src/app/shared/shared-actor-image/actor-avatar.component.ts6
1 files changed, 4 insertions, 2 deletions
diff --git a/client/src/app/shared/shared-actor-image/actor-avatar.component.ts b/client/src/app/shared/shared-actor-image/actor-avatar.component.ts
index bc7e8a096..b2e1ef46e 100644
--- a/client/src/app/shared/shared-actor-image/actor-avatar.component.ts
+++ b/client/src/app/shared/shared-actor-image/actor-avatar.component.ts
@@ -89,9 +89,11 @@ export class ActorAvatarComponent {
89 } 89 }
90 90
91 private getColorTheme () { 91 private getColorTheme () {
92 const initialLowercase = this.initial.toLowerCase()
93
92 // Keep consistency with CSS 94 // Keep consistency with CSS
93 const themes = { 95 const themes = {
94 abc: 'blue', 96 '0123456789abc': 'blue',
95 def: 'green', 97 def: 'green',
96 ghi: 'purple', 98 ghi: 'purple',
97 jkl: 'gray', 99 jkl: 'gray',
@@ -102,7 +104,7 @@ export class ActorAvatarComponent {
102 } 104 }
103 105
104 const theme = Object.keys(themes) 106 const theme = Object.keys(themes)
105 .find(chars => chars.includes(this.initial)) 107 .find(chars => chars.includes(initialLowercase))
106 108
107 return themes[theme] 109 return themes[theme]
108 } 110 }