forked from quasarframework/quasar
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsplashscreen.js
More file actions
33 lines (27 loc) · 736 Bytes
/
splashscreen.js
File metadata and controls
33 lines (27 loc) · 736 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
const getSquareIcon = require('../utils/get-square-icon')
module.exports = async function (file, opts, done) {
const size = Math.min(file.width, file.height)
const img = opts.background
.clone()
.resize(file.width, file.height)
.flatten({
background: opts.splashscreenColor
})
if (opts.splashscreenIconRatio > 0) {
const icon = getSquareIcon({
file,
icon: opts.icon,
size: Math.round(size * opts.splashscreenIconRatio / 100),
padding: opts.padding
})
const buffer = await icon.toBuffer()
img.composite([
{ input: buffer }
])
}
img
.png()
.toFile(file.absoluteName)
.then(() => opts.compression.png(file.absoluteName))
.then(done)
}