-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathidenticon-avatar.html
64 lines (61 loc) · 1.25 KB
/
identicon-avatar.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<link rel="import" href="../polymer/polymer.html">
<link rel="import" href="blockies-import.html">
<dom-module id="identicon-avatar">
<template>
<style>
:host {
display: block;
box-sizing: border-box;
}
</style>
</template>
</dom-module>
<script>
/**
* `identicon-avatar`
*
*
* @customElement
* @polymer
* @demo demo/index.html
*/
class IdenticonAvatar extends Polymer.Element {
static get is() { return 'identicon-avatar'; }
static get properties() {
return {
seed: {
type: String,
value: 'test'
},
color: {
type: String,
value: '#88df88'
},
bgColor: {
type: String,
value: '#eee'
},
size: {
type: Number,
value: 5
},
scale: {
type: Number,
value: 50
}
};
}
ready() {
super.ready();
const avatar = blockies.create({
seed: this.seed,
color: this.color,
bgcolor: this.bgColor,
size: this.size,
scale: this.scale
});
this.shadowRoot.appendChild(avatar);
}
}
window.customElements.define(IdenticonAvatar.is, IdenticonAvatar);
</script>