Skip to content

Commit e81f2ff

Browse files
Added color testing component
1 parent 338927a commit e81f2ff

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<template>
2+
<v-btn-toggle
3+
v-model="selectedColor"
4+
density="compact"
5+
divided
6+
>
7+
<v-btn
8+
v-for="(themeColor, themeName) in themeColors"
9+
:key="themeName"
10+
:color="themeColor"
11+
size="small"
12+
:value="themeName"
13+
@click="emitUpdate"
14+
>{{ themeName }}</v-btn>
15+
</v-btn-toggle>
16+
</template>
17+
18+
<script setup lang="ts">
19+
/* eslint-disable vue/sort-keys */
20+
import {
21+
ref,
22+
unref,
23+
} from 'vue';
24+
import { useTheme } from 'vuetify';
25+
26+
27+
const emit = defineEmits(['update']);
28+
const theme = useTheme();
29+
30+
const selectedColor = ref('primary');
31+
const { colors } = unref(theme.current);
32+
33+
const themeColors = ref({
34+
primary: colors.primary,
35+
secondary: colors.secondary,
36+
success: colors.success,
37+
accent: colors.accent,
38+
info: colors.info,
39+
warning: colors.warning,
40+
danger: colors.danger,
41+
error: colors.error,
42+
});
43+
44+
function emitUpdate() {
45+
emit('update', selectedColor.value);
46+
}
47+
</script>

0 commit comments

Comments
 (0)