diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2020-07-25 02:01:14 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2020-07-25 02:01:14 +0900 |
| commit | 1a2de1a0518a6c1faa3d1d1fd78f8f24613d6a8b (patch) | |
| tree | 4ca99d3812c6807702d68b5d46555896cb9946a2 /src/client/components | |
| parent | Revert "refactor(client): Use v-t for i18n" (diff) | |
| parent | Fix #6581? (#6585) (diff) | |
| download | sharkey-1a2de1a0518a6c1faa3d1d1fd78f8f24613d6a8b.tar.gz sharkey-1a2de1a0518a6c1faa3d1d1fd78f8f24613d6a8b.tar.bz2 sharkey-1a2de1a0518a6c1faa3d1d1fd78f8f24613d6a8b.zip | |
Merge branch 'develop' of https://github.com/syuilo/misskey into develop
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); } |