diff options
| author | Acid Chicken (硫酸鶏) <root@acid-chicken.com> | 2020-07-24 16:58:26 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-07-25 01:58:26 +0900 |
| commit | 83900cbca64b76f6863a3ceca70c0a66dfa6d4fc (patch) | |
| tree | c0409fd0df6c34d6772f1ebf958016580bef5304 /src/client/components | |
| parent | perf(client): Use v-once for static contents (diff) | |
| download | sharkey-83900cbca64b76f6863a3ceca70c0a66dfa6d4fc.tar.gz sharkey-83900cbca64b76f6863a3ceca70c0a66dfa6d4fc.tar.bz2 sharkey-83900cbca64b76f6863a3ceca70c0a66dfa6d4fc.zip | |
Fix #6581? (#6585)
* Update avatar.vue
* Update avatar.vue
* Update avatar.vue
Diffstat (limited to 'src/client/components')
| -rw-r--r-- | src/client/components/avatar.vue | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/client/components/avatar.vue b/src/client/components/avatar.vue index fd4ab78ce1..ef376aa93e 100644 --- a/src/client/components/avatar.vue +++ b/src/client/components/avatar.vue @@ -40,7 +40,23 @@ export default Vue.extend({ : this.user.avatarUrl; }, }, + watch: { + 'user.avatarBlurhash'() { + this.$el.style.color = this.getBlurhashAvgColor(this.user.avatarBlurhash); + } + }, + mounted() { + this.$el.style.color = this.getBlurhashAvgColor(this.user.avatarBlurhash); + }, methods: { + getBlurhashAvgColor(s) { + return typeof s == 'string' + ? '#' + [...s.slice(2, 6)] + .map(x => '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz#$%*+,-.:;=?@[]^_{|}~'.indexOf(x)) + .reduce((a, c) => a * 83 + c, 0) + .toString(16) + : undefined; + }, onClick(e) { this.$emit('click', e); } |