api-client/components/smart/ColorModePicker.vue

73 lines
1.7 KiB
Vue
Raw Normal View History

2020-09-24 02:52:54 +00:00
<template>
2020-12-12 13:46:37 +00:00
<div class="flex flex-col">
2020-09-24 02:52:54 +00:00
<label>
2021-07-02 16:30:08 +00:00
<!-- <ColorScheme placeholder="..." tag="span">
2020-09-24 02:52:54 +00:00
{{ $t("background") }}:
2021-05-18 09:27:29 +00:00
{{
$colorMode.preference.charAt(0).toUpperCase() +
$colorMode.preference.slice(1)
}}
2020-09-24 02:52:54 +00:00
<span v-if="$colorMode.preference === 'system'">
({{ $colorMode.value }} mode detected)
</span>
2021-07-02 16:30:08 +00:00
</ColorScheme> -->
2020-09-24 02:52:54 +00:00
</label>
2020-12-12 13:46:37 +00:00
<div>
2020-09-24 02:52:54 +00:00
<span
v-for="(color, index) of colors"
:key="`color-${index}`"
2021-07-02 16:30:08 +00:00
v-tippy="{ theme: 'tooltip' }"
:title="`${color.charAt(0).toUpperCase()}${color.slice(1)}`"
2021-05-15 12:43:31 +00:00
class="
inline-flex
items-center
justify-center
p-3
m-2
transition
duration-150
ease-in-out
bg-transparent
rounded-full
cursor-pointer
2021-06-12 16:46:17 +00:00
text-secondaryLight
hover:text-secondary
2021-05-15 12:43:31 +00:00
"
2020-09-24 02:52:54 +00:00
:class="[
2021-06-12 16:46:17 +00:00
{ 'bg-primary': color === $colorMode.preference },
{ 'text-accent hover:text-accent': color === $colorMode.value },
2020-09-24 02:52:54 +00:00
]"
@click="$colorMode.preference = color"
>
<i class="material-icons">{{ getIcon(color) }}</i>
</span>
</div>
2020-12-11 16:54:34 +00:00
</div>
2020-09-24 02:52:54 +00:00
</template>
<script>
export default {
data() {
return {
colors: ["system", "light", "dark", "black"],
}
},
methods: {
getIcon(color) {
switch (color) {
case "system":
return "desktop_windows"
case "light":
return "wb_sunny"
case "dark":
return "nights_stay"
case "black":
return "bedtime"
default:
return "desktop_windows"
}
},
},
}
</script>