You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
<template>
|
|
|
|
<div v-html="generateIdenticon()" class="w-fit"></div>
|
|
|
|
</template>
|
|
|
|
<script lang="ts">
|
|
|
|
import { Vue, Component, Prop } from "vue-facing-decorator";
|
|
|
|
import { toSvg } from "jdenticon";
|
|
|
|
|
|
|
|
const BLANK_CONFIG = {
|
|
|
|
lightness: {
|
|
|
|
color: [1.0, 1.0],
|
|
|
|
grayscale: [1.0, 1.0],
|
|
|
|
},
|
|
|
|
saturation: {
|
|
|
|
color: 0.0,
|
|
|
|
grayscale: 0.0,
|
|
|
|
},
|
|
|
|
backColor: "#0000",
|
|
|
|
};
|
|
|
|
|
|
|
|
@Component
|
|
|
|
export default class EntityIcon extends Vue {
|
|
|
|
@Prop entityId = "";
|
|
|
|
@Prop iconSize = 0;
|
|
|
|
|
|
|
|
generateIdenticon() {
|
|
|
|
const config = this.entityId ? undefined : BLANK_CONFIG;
|
|
|
|
const svgString = toSvg(this.entityId, this.iconSize, config);
|
|
|
|
return svgString;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
<style scoped></style>
|