-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b80c492
commit 956c363
Showing
17 changed files
with
1,804 additions
and
64 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { App } from "vue"; | ||
|
||
import BtTheme from "./src/IndexPage.vue"; | ||
|
||
export default (app: App) => { | ||
app.component(BtTheme.name, BtTheme); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
<template> | ||
<q-toggle | ||
v-if="props.showThemeToggle" | ||
v-model="isDark" | ||
@update:model-value="change" | ||
/> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { watchEffect, ref, defineProps } from "vue"; | ||
import { useQuasar, setCssVar, getCssVar, colors } from "quasar"; | ||
interface Props { | ||
showThemeToggle: boolean; | ||
} | ||
const props = withDefaults(defineProps<Props>(), { | ||
showToggle: false | ||
}); | ||
const { getPaletteColor, changeAlpha } = colors; | ||
const $q = useQuasar(); | ||
const isDark = ref(false); | ||
if (props.showThemeToggle) { | ||
$q.dark.set(true); | ||
isDark.value = true; | ||
} | ||
const change = () => { | ||
$q.dark.toggle(); | ||
}; | ||
const variables = [ | ||
"background-1", | ||
"background-2", | ||
"background-3", | ||
"background-4", | ||
"background-5", | ||
"background-6", | ||
"background-hover", | ||
"background-selected", | ||
"separator", | ||
"separator-2", | ||
"ink-1", | ||
"ink-2", | ||
"ink-3", | ||
"ink-on-brand", | ||
"ink-on-brand-disabled", | ||
"input-bg-disabled", | ||
"input-stroke", | ||
"input-stroke-hover", | ||
"input-stroke-disabled", | ||
"radio-stroke", | ||
"radio-stroke-hover", | ||
"radio-stroke-disabled", | ||
"btn-bg-hover", | ||
"btn-bg-pressed", | ||
"btn-stroke", | ||
"btn-stroke-hover", | ||
"btn-stroke-disabled", | ||
"orange-soft", | ||
"orange-alpha", | ||
"orange-default", | ||
"orange-hover", | ||
"orange-pressed", | ||
"orange-disabled", | ||
"blue-soft", | ||
"blue-alpha", | ||
"blue-default", | ||
"blue-hover", | ||
"blue-pressed", | ||
"blue-disabled", | ||
"red-soft", | ||
"red-alpha", | ||
"red-default", | ||
"red-hover", | ||
"red-pressed", | ||
"red-disabled", | ||
"yellow-soft", | ||
"yellow-alpha", | ||
"yellow-default", | ||
"yellow-hover", | ||
"yellow-pressed", | ||
"yellow-disabled", | ||
"green-soft", | ||
"green-alpha", | ||
"green-default", | ||
"green-hover", | ||
"green-pressed", | ||
"green-disabled", | ||
"teal-soft", | ||
"teal-alpha", | ||
"teal-default", | ||
"teal-hover", | ||
"teal-pressed", | ||
"teal-disabled", | ||
"light-blue-soft", | ||
"light-blue-alpha", | ||
"light-blue-default", | ||
"light-blue-hover", | ||
"light-blue-pressed", | ||
"light-blue-disabled", | ||
"light-green-soft", | ||
"light-green-alpha", | ||
"light-green-default", | ||
"light-green-hover", | ||
"light-green-pressed", | ||
"light-green-disabled" | ||
]; | ||
const light = variables.map((item) => ({ | ||
name: item, | ||
value: getPaletteColor(`${item}-light`) | ||
})); | ||
const dark = variables.map((item) => ({ | ||
name: item, | ||
value: getPaletteColor(`${item}-dark`) | ||
})); | ||
watchEffect(() => { | ||
if ($q.dark.isActive) { | ||
dark.forEach((item) => { | ||
setCssVar(item.name, item.value); | ||
}); | ||
} else { | ||
light.forEach((item) => { | ||
setCssVar(item.name, item.value); | ||
}); | ||
} | ||
}); | ||
</script> | ||
<script lang="ts"> | ||
import { defineComponent } from "vue"; | ||
export default defineComponent({ | ||
name: "BtTheme" | ||
}); | ||
</script> | ||
<style></style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { useQuasar, colors } from "quasar"; | ||
import { ref, watchEffect } from "vue"; | ||
|
||
const { getPaletteColor } = colors; | ||
const $q = useQuasar(); | ||
|
||
function useColor(variable: string) { | ||
const $q = useQuasar(); | ||
const color = ref(getPaletteColor(variable)); | ||
|
||
watchEffect(() => { | ||
color.value = $q.dark.isActive | ||
? getPaletteColor(variable) | ||
: getPaletteColor(variable); | ||
}); | ||
|
||
return { color }; | ||
} | ||
|
||
export default useColor; |
Oops, something went wrong.