api-client/components/smart/AccentModePicker.vue

56 lines
1.2 KiB
Vue
Raw Normal View History

2020-09-24 02:52:54 +00:00
<template>
<div class="flex">
<!-- text-blue-400 -->
<!-- text-green-400 -->
<!-- text-teal-400 -->
<!-- text-indigo-400 -->
<!-- text-purple-400 -->
<!-- text-orange-400 -->
<!-- text-pink-400 -->
<!-- text-red-400 -->
<!-- text-yellow-400 -->
<ButtonSecondary
v-for="(color, index) of accentColors"
:key="`color-${index}`"
v-tippy="{ theme: 'tooltip' }"
:title="`${color.charAt(0).toUpperCase()}${color.slice(1)}`"
:class="[{ 'bg-primaryLight': color === active }]"
icon="lens"
:color="color"
@click.native="setActiveColor(color)"
/>
2020-12-11 16:54:34 +00:00
</div>
2020-09-24 02:52:54 +00:00
</template>
2021-07-06 12:20:37 +00:00
<script lang="ts">
import Vue from "vue"
import {
HoppAccentColors,
HoppAccentColor,
getSettingSubject,
settingsStore,
applySetting,
} from "~/newstore/settings"
2021-06-21 04:27:45 +00:00
2021-07-06 12:20:37 +00:00
export default Vue.extend({
2020-09-24 02:52:54 +00:00
data() {
return {
2021-07-06 12:20:37 +00:00
accentColors: HoppAccentColors,
active: settingsStore.value.THEME_COLOR,
2020-09-24 02:52:54 +00:00
}
},
2021-07-06 12:20:37 +00:00
subscriptions() {
return {
active: getSettingSubject("THEME_COLOR"),
}
2021-05-18 09:27:29 +00:00
},
2020-09-24 02:52:54 +00:00
methods: {
2021-07-06 12:20:37 +00:00
setActiveColor(color: HoppAccentColor) {
2020-09-24 02:52:54 +00:00
document.documentElement.setAttribute("data-accent", color)
2021-07-06 12:20:37 +00:00
applySetting("THEME_COLOR", color)
2020-09-24 02:52:54 +00:00
},
},
2021-07-06 12:20:37 +00:00
})
2020-09-24 02:52:54 +00:00
</script>