AccentModePicker.vue 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <template>
  2. <div class="flex">
  3. <!-- text-green-500 -->
  4. <!-- text-teal-500 -->
  5. <!-- text-blue-500 -->
  6. <!-- text-indigo-500 -->
  7. <!-- text-purple-500 -->
  8. <!-- text-yellow-500 -->
  9. <!-- text-orange-500 -->
  10. <!-- text-red-500 -->
  11. <!-- text-pink-500 -->
  12. <ButtonSecondary
  13. v-for="(color, index) of accentColors"
  14. :key="`color-${index}`"
  15. v-tippy="{ theme: 'tooltip' }"
  16. :title="`${color.charAt(0).toUpperCase()}${color.slice(1)}`"
  17. :class="[{ 'bg-primaryLight': color === active }]"
  18. class="rounded"
  19. icon="lens"
  20. :color="color"
  21. @click.native="setActiveColor(color)"
  22. />
  23. </div>
  24. </template>
  25. <script setup lang="ts">
  26. import {
  27. HoppAccentColors,
  28. HoppAccentColor,
  29. applySetting,
  30. useSetting,
  31. } from "~/newstore/settings"
  32. const accentColors = HoppAccentColors
  33. const active = useSetting("THEME_COLOR")
  34. const setActiveColor = (color: HoppAccentColor) => {
  35. document.documentElement.setAttribute("data-accent", color)
  36. applySetting("THEME_COLOR", color)
  37. }
  38. </script>