Skip to content

Commit

Permalink
feat: support transparent background (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
lyqht authored Aug 8, 2024
1 parent 0a5db60 commit 41d948e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
1 change: 1 addition & 0 deletions locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"Corners Square type": "Corners Square type",
"Corners Dot color": "Corners Dot color",
"Corners Dot type": "Corners Dot type",
"With background": "With background",
"QR code preset": "QR code preset",
"Preset": "Preset",
"dots": "dots",
Expand Down
28 changes: 27 additions & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,17 @@ const cornersDotOptionsType = ref()
const styleBorderRadius = ref()
const styledBorderRadiusFormatted = computed(() => `${styleBorderRadius.value}px`)
const styleBackground = ref(defaultPreset.style.background)
const lastBackground = ref(defaultPreset.style.background)
const withBackground = ref(true)
watch(withBackground, () => {
if (!withBackground.value) {
lastBackground.value = styleBackground.value
styleBackground.value = 'transparent'
} else {
styleBackground.value = lastBackground.value
}
})
const dotsOptions = computed(() => ({
color: dotsOptionsColor.value,
Expand Down Expand Up @@ -592,7 +603,22 @@ onMounted(() => {
v-model="image"
/>
</div>
<div id="color-settings" class="flex w-full flex-row flex-wrap gap-4">
<div class="flex flex-row items-center gap-2">
<label for="with-background">
{{ t('With background') }}
</label>
<input
id="with-background"
type="checkbox"
class="checkbox"
v-model="withBackground"
/>
</div>
<div
id="color-settings"
:inert="!withBackground"
:class="[!withBackground && 'opacity-30', 'flex w-full flex-row flex-wrap gap-4']"
>
<div class="flex flex-row items-center gap-2">
<label for="background-color">{{ t('Background color') }}</label>
<input
Expand Down

0 comments on commit 41d948e

Please sign in to comment.