Merge pull request #1695 from JoelJacobStephen/main

Simplified the capitalization of Accent Color Names by using a function.
This commit is contained in:
Andrew Bastin
2021-06-01 13:24:32 -04:00
committed by GitHub

View File

@@ -2,7 +2,7 @@
<div class="flex flex-col"> <div class="flex flex-col">
<label <label
>{{ $t("color") }}: >{{ $t("color") }}:
{{ active.charAt(0).toUpperCase() + active.slice(1) }}</label {{ capitalized(active) }}</label
> >
<div> <div>
<!-- text-blue-400 --> <!-- text-blue-400 -->
@@ -17,7 +17,7 @@
<span <span
v-for="(color, index) of accentColors" v-for="(color, index) of accentColors"
:key="`color-${index}`" :key="`color-${index}`"
v-tooltip="`${color.charAt(0).toUpperCase()}${color.slice(1)}`" v-tooltip="capitalized(color)"
class=" class="
inline-flex inline-flex
items-center items-center
@@ -61,14 +61,19 @@ export default {
}, },
watch: { watch: {
active(color) { active(color) {
localStorage.setItem("THEME_COLOR", color) localStorage.setItem("THEME_COLOR", color)
}, },
}, },
methods: { methods: {
setActiveColor(color) { setActiveColor(color) {
document.documentElement.setAttribute("data-accent", color) document.documentElement.setAttribute("data-accent", color)
this.active = color this.active = color
}, },
capitalized(color) {
return `${color.charAt(0).toUpperCase()}${color.slice(1)}`
},
}, },
} }
</script> </script>