<template>
  <div class="name-style" :style="{ backgroundColor: getName().color, fontSize: `${size}px` }">
    {{ getName().firstName }}
  </div>
</template>

<script setup lang="ts">
const props = defineProps(['appName', 'size']);

const getName = () => {
  const name = props.appName || '';
  const colorList = ['#447dfd', '#ee4c2b', '#00c4bb', '#009bdd', '#06c144', '#ff8b10'];

  const firstName = name[0];
  const color = colorList[name.length % 6];

  return {
    firstName,
    color,
  };

};

</script>

<style lang="scss" scoped>
.name-style {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background-color: cornflowerblue;
  font-size: 40px;
}
</style>
