Skip to content

Commit

Permalink
feat: switch theme color on theme toggling (elk-zone#454)
Browse files Browse the repository at this point in the history
Co-authored-by: Anthony Fu <[email protected]>
  • Loading branch information
userquin and antfu authored Dec 19, 2022
1 parent 6eef0fe commit db8c2ad
Show file tree
Hide file tree
Showing 19 changed files with 35 additions and 101 deletions.
4 changes: 4 additions & 0 deletions composables/pwa/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ import { useRegisterSW } from 'virtual:pwa-register/vue'
export const usePWA = () => {
const online = useOnline()

useHead({
meta: [{ id: 'theme-color', name: 'theme-color', content: computed(() => isDark.value ? '#111111' : '#ffffff') }],
})

const {
needRefresh,
updateServiceWorker,
Expand Down
2 changes: 2 additions & 0 deletions config/pwa.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,14 @@ const pwa: VitePWANuxtOptions = {
sizes: '512x512',
type: 'image/png',
},
/*
{
src: 'logo.svg',
sizes: '250x250',
type: 'image/png',
purpose: 'any maskable',
},
*/
],
},
injectManifest: {
Expand Down
12 changes: 4 additions & 8 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { isCI, isDevelopment } from 'std-env'
import { i18n } from './config/i18n'
import { pwa } from './config/pwa'

const isPreview = process.env.PULL_REQUEST === 'true'
const isPreview = process.env.PULL_REQUEST === 'true' || process.env.CONTEXT === 'deploy-preview' || process.env.CONTEXT === 'dev'

export default defineNuxtConfig({
typescript: {
Expand Down Expand Up @@ -110,14 +110,10 @@ export default defineNuxtConfig({
class: 'overflow-x-hidden',
},
link: [
{ rel: 'icon', type: 'image/png', href: '/favicon.png' },
{ rel: 'alternate icon', type: 'image/x-icon', href: '/favicon.ico' },
{ rel: 'icon', type: 'image/png', href: '/favicon-16x16.png', sizes: '16x16' },
{ rel: 'icon', type: 'image/png', href: '/favicon-32x32.png', sizes: '32x32' },
{ rel: 'mask-icon', href: '/safari-pinned-tab.svg', color: '#ffffff' },
{ rel: 'apple-touch-icon', href: '/apple-touch-icon.png', sizes: '180x180' },
{ rel: 'icon', href: '/favicon.ico', sizes: 'any' },
{ rel: 'icon', type: 'image/svg+xml', href: '/favicon.svg' },
{ rel: 'apple-touch-icon', href: '/apple-touch-icon.png' },
],
meta: [{ name: 'theme-color', content: '#ffffff' }],
},
},
i18n,
Expand Down
Binary file modified public-dev/apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed public-dev/favicon-16x16.png
Binary file not shown.
Binary file removed public-dev/favicon-32x32.png
Binary file not shown.
Binary file modified public-dev/favicon.ico
Binary file not shown.
Binary file modified public-dev/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions public-dev/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 6 additions & 6 deletions public-dev/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public-dev/pwa-192x192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public-dev/pwa-512x512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed public/favicon-16x16.png
Binary file not shown.
Binary file removed public/favicon-32x32.png
Binary file not shown.
16 changes: 8 additions & 8 deletions public/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/pwa-192x192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/pwa-512x512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit db8c2ad

Please sign in to comment.