Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(pwa): add monochrome manifest icons #2902

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions modules/pwa/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,23 @@ export async function createI18n(): Promise<LocalizedWebManifest> {
sizes: '64x64',
type: 'image/png',
},
{
src: 'monochrome-64x64.png',
sizes: '64x64',
type: 'image/png',
purpose: 'monochrome',
},
{
src: 'pwa-192x192.png',
sizes: '192x192',
type: 'image/png',
},
{
src: 'monochrome-192x192.png',
sizes: '192x192',
type: 'image/png',
purpose: 'monochrome',
},
{
src: 'pwa-512x512.png',
sizes: '512x512',
Expand All @@ -100,6 +112,12 @@ export async function createI18n(): Promise<LocalizedWebManifest> {
type: 'image/png',
purpose: 'maskable',
},
{
src: 'monochrome-512x512.png',
sizes: '512x512',
type: 'image/png',
purpose: 'monochrome',
},
],
share_target: {
action: '/web-share-target',
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
"lint-staged": "^15.2.2",
"nuxt": "^3.11.2",
"prettier": "^3.2.5",
"sharp": "^0.33.3",
"sharp": "0.32.6",
"sharp-ico": "^0.1.5",
"simple-git-hooks": "^2.11.1",
"tsx": "^4.7.2",
Expand Down
702 changes: 298 additions & 404 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

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 modified public-dev/maskable-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 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-dev/pwa-64x64.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-staging/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 modified public-staging/maskable-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 modified public-staging/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-staging/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-staging/pwa-64x64.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 modified public/maskable-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 added public/monochrome-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 added public/monochrome-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 added public/monochrome-64x64.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 42 additions & 0 deletions public/monochrome-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.
Binary file modified public/pwa-64x64.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions scripts/generate-pwa-icons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ async function generateTransparentIcons(icons: ResolvedIcons, svgLogo: string, f
const { sizes, padding, resizeOptions } = icons.transparent
await Promise.all(sizes.map(async (size) => {
const filePath = resolve(folder, icons.iconName('transparent', size))
console.log(filePath)
userquin marked this conversation as resolved.
Show resolved Hide resolved
await sharp({
create: {
width: size,
Expand Down Expand Up @@ -189,6 +190,26 @@ async function generatePWAIcons(folders: string[], icons: Icons) {
apple,
ico,
})))

const svgLogo = resolve(folders[0], 'monochrome-logo.svg')

await generateTransparentIcons({
png: { compressionLevel: 9, quality: 60 },
iconName: (type, size) => {
switch (type) {
case 'transparent':
return `monochrome-${size}x${size}-temp.png`
case 'maskable':
return `maskable-icon-${size}x${size}.png`
case 'apple':
return `apple-touch-icon-${size}x${size}.png`
}
},
transparent,
maskable,
apple,
ico,
}, svgLogo, folders[0])
}

console.log('Generating Elk PWA Icons...')
Expand Down
Loading