Merge branch 'avatars' of github.com:m1k1o/neko into dev

This commit is contained in:
m1k1o 2020-10-18 17:20:24 +02:00
commit ef67c559a8

View File

@ -7,7 +7,7 @@
height: size + 'px', height: size + 'px',
lineHeight: size + 'px', lineHeight: size + 'px',
fontSize: (size/2) + 'px', fontSize: (size/2) + 'px',
backgroundColor: Background(), backgroundColor: Background(seed),
}"> }">
{{ seed.substring(0, 2).toUpperCase() }} {{ seed.substring(0, 2).toUpperCase() }}
</div> </div>
@ -35,12 +35,12 @@
@Prop(String) readonly seed: string | undefined; @Prop(String) readonly seed: string | undefined;
@Prop(Number) readonly size: number | undefined; @Prop(Number) readonly size: number | undefined;
Background() { Background(seed: string) {
let a = 0, b = 0, c = 0; let a = 0, b = 0, c = 0;
for(let i = 0; i < this.seed.length; i++) { for(let i = 0; i < seed.length; i++) {
a += this.seed.charCodeAt(i) * 3; a += seed.charCodeAt(i) * 3;
b += this.seed.charCodeAt(i) * 5; b += seed.charCodeAt(i) * 5;
c += this.seed.charCodeAt(i) * 7; c += seed.charCodeAt(i) * 7;
} }
let x = Math.floor(128 + (a % 128)); let x = Math.floor(128 + (a % 128));