forked from tauri-apps/tauri
-
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.
feat(icons): add and test icon generation for tauri (tauri-apps#55)
- Loading branch information
1 parent
94ead18
commit 596f621
Showing
19 changed files
with
2,135 additions
and
88 deletions.
There are no files selected for viewing
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,9 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
indent_style = space | ||
indent_size = 2 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true |
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 |
---|---|---|
|
@@ -62,3 +62,4 @@ package-lock.json | |
|
||
|
||
src-tauri | ||
test/jest/tmp |
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
File renamed without changes
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,61 @@ | ||
const parseArgs = require('minimist') | ||
const { appDir, tauriDir } = require('../helpers/app-paths') | ||
const logger = require('../helpers/logger') | ||
const log = logger('app:tauri') | ||
const warn = logger('app:tauri (icon)', 'red') | ||
const { tauricon } = require('../helpers/tauricon') | ||
const { resolve } = require('path') | ||
|
||
/** | ||
* @type {object} | ||
* @property {boolean} h | ||
* @property {boolean} help | ||
* @property {string|boolean} f | ||
* @property {string|boolean} force | ||
* @property {boolean} l | ||
* @property {boolean} log | ||
* @property {boolean} c | ||
* @property {boolean} config | ||
* @property {boolean} s | ||
* @property {boolean} source | ||
* @property {boolean} t | ||
* @property {boolean} target | ||
*/ | ||
const argv = parseArgs(process.argv.slice(2), { | ||
alias: { | ||
h: 'help', | ||
l: 'log', | ||
c: 'config', | ||
s: 'source', | ||
t: 'target' | ||
}, | ||
boolean: ['h', 'l'] | ||
}) | ||
|
||
if (argv.help) { | ||
console.log(` | ||
Description | ||
Create all the icons you need for your Tauri app. | ||
Usage | ||
$ tauri icon | ||
Options | ||
--help, -h Displays this message | ||
--log, l Logging [boolean] | ||
--icon, i Source icon (png, 1240x1240 with transparency) | ||
--target, t Target folder (default: 'src-tauri/icons') | ||
--compression, c Compression type [pngquant|optipng|zopfli] | ||
`) | ||
process.exit(0) | ||
} | ||
|
||
tauricon.make( | ||
argv.i || resolve(appDir, 'app-icon.png'), | ||
argv.t || resolve(tauriDir, 'icons'), | ||
argv.c || 'optipng' | ||
).then(() => { | ||
log('(tauricon) Completed') | ||
}).catch(e => { | ||
warn(e) | ||
}) |
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,92 @@ | ||
exports.options = { | ||
// folder determines in which path to drop the generated file | ||
// prefix is the first part of the generated file's name | ||
// infix adds e.g. '44x44' based on the size in sizes to the generated file's name | ||
// suffix adds a file-ending to the generated file's name | ||
// sizes determines the pixel width and height to use | ||
background_color: '#000074', | ||
theme_color: '#02aa9b', | ||
sharp: 'kernel: sharp.kernel.lanczos3', // one of [nearest|cubic|lanczos2|lanczos3] | ||
minify: { | ||
batch: false, | ||
overwrite: true, | ||
available: ['pngquant', 'optipng', 'zopfli'], | ||
type: 'pngquant', | ||
pngcrushOptions: { | ||
reduce: true | ||
}, | ||
pngquantOptions: { | ||
quality: [0.6, 0.8], | ||
floyd: 0.1, // 0.1 - 1 | ||
speed: 10 // 1 - 10 | ||
}, | ||
optipngOptions: { | ||
optimizationLevel: 4, | ||
bitDepthReduction: true, | ||
colorTypeReduction: true, | ||
paletteReduction: true | ||
}, | ||
zopfliOptions: { | ||
transparent: true, | ||
more: true | ||
} | ||
}, | ||
splash_type: 'generate', | ||
tauri: { | ||
linux: { | ||
folder: '.', | ||
prefix: '', | ||
infix: true, | ||
suffix: '.png', | ||
sizes: [ | ||
32, 128 | ||
] | ||
}, | ||
linux_2x: { | ||
folder: '.', | ||
prefix: '128x128@2x', | ||
infix: false, | ||
suffix: '.png', | ||
sizes: [ | ||
256 | ||
] | ||
}, | ||
defaults: { | ||
folder: '.', | ||
prefix: 'icon', | ||
infix: false, | ||
suffix: '.png', | ||
sizes: [ | ||
512 | ||
] | ||
}, | ||
appx_logo: { | ||
folder: '.', | ||
prefix: 'StoreLogo', | ||
infix: false, | ||
suffix: '.png', | ||
sizes: [ | ||
50 | ||
] | ||
}, | ||
appx_square: { | ||
folder: '.', | ||
prefix: 'Square', | ||
infix: true, | ||
suffix: 'Logo.png', | ||
sizes: [ | ||
30, | ||
44, | ||
71, | ||
89, | ||
107, | ||
142, | ||
150, | ||
284, | ||
310 | ||
] | ||
} | ||
// todo: look at capacitor and cordova for insight into what icons | ||
// we need for those distribution targets | ||
} | ||
} |
Oops, something went wrong.