Skip to content
Snippets Groups Projects
Unverified Commit 83900cbc authored by Acid Chicken (硫酸鶏)'s avatar Acid Chicken (硫酸鶏) Committed by GitHub
Browse files

Fix #6581? (#6585)

* Update avatar.vue

* Update avatar.vue

* Update avatar.vue
parent da874f33
No related branches found
No related tags found
No related merge requests found
......@@ -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);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment