Skip to content

Commit

Permalink
test: test
Browse files Browse the repository at this point in the history
  • Loading branch information
jbaubree committed Dec 22, 2023
1 parent de978e0 commit 84950b8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions playground/src/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const isDarkModeActive = ref(isDark.value)
const isDialogOpen = ref(false)
const input = ref('')
const activeItem = ref()
const { primaryColor } = useAppTheme()
const { primaryColor, setPrimaryColor } = useAppTheme()
const toast = useToast()
const primaryOptions = computed(() => (Object.keys(colors) as (keyof typeof colors)[]).filter((color) => {
return !['inherit', 'current', 'black', 'white', 'light', 'dark', 'transparent', 'primary', 'pilot', 'success', 'danger'].includes(color)
Expand Down Expand Up @@ -179,7 +179,7 @@ const date = ref()
v-for="color, index in primaryOptions"
:key="index"
class="flex cursor-pointer items-center gap-1"
@click="primaryColor = color"
@click="setPrimaryColor(color)"
>
<span
class="font-medium capitalize transition-colors"
Expand Down
6 changes: 6 additions & 0 deletions src/composables/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,14 @@ export function useAppUi() {

export function useAppTheme(): {
primaryColor: RemovableRef<keyof typeof colors>
setPrimaryColor: (color: keyof typeof colors) => void
} {
const primaryColor = useLocalStorage<keyof typeof colors>('unuse-ui-primary', 'fluo')

function setPrimaryColor(color: keyof typeof colors) {
primaryColor.value = color
}

const hexToRgb = (hex) => {
// Expand shorthand form (e.g. "03F") to full form (e.g. "0033FF")
const shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i
Expand All @@ -35,5 +40,6 @@ export function useAppTheme(): {

return {
primaryColor,
setPrimaryColor,
}
}

0 comments on commit 84950b8

Please sign in to comment.