mirror of
				https://codeberg.org/yeentown/barkey.git
				synced 2025-11-04 07:24:13 +00:00 
			
		
		
		
	* Update avatar.vue * Update avatar.vue * Update avatar.vue
This commit is contained in:
		
							parent
							
								
									da874f3383
								
							
						
					
					
						commit
						83900cbca6
					
				
					 1 changed files with 16 additions and 0 deletions
				
			
		| 
						 | 
					@ -40,7 +40,23 @@ export default Vue.extend({
 | 
				
			||||||
				: this.user.avatarUrl;
 | 
									: 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: {
 | 
						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) {
 | 
							onClick(e) {
 | 
				
			||||||
			this.$emit('click', e);
 | 
								this.$emit('click', e);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue