Skip to content

Commit

Permalink
Merge pull request #104 from fcastilloec/master
Browse files Browse the repository at this point in the history
Add support for scalable icons
  • Loading branch information
fcastilloec authored Sep 29, 2017
2 parents 8e98d66 + ece233e commit c7ca620
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 3 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -357,10 +357,12 @@ Or multiple images with their corresponding resolutions:
'48x48': 'resources/Icon48.png',
'64x64': 'resources/Icon64.png',
'128x128': 'resources/Icon128.png',
'256x256': 'resources/Icon256.png'
'256x256': 'resources/Icon256.png',
'scalable': 'resources/Icon.svg'
}
}
```
Note that the image files must be one of the types: PNG or SVG. The support for SVG works only on `scalable` resolution.

#### options.categories
Type: `Array[String]`
Expand Down
7 changes: 6 additions & 1 deletion src/installer.js
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,12 @@ var createPixmapIcon = function (options, dir, callback) {
*/
var createHicolorIcon = function (options, dir, callback) {
async.forEachOf(options.icon, function (icon, resolution, callback) {
var iconFile = path.join(dir, 'usr/share/icons/hicolor', resolution, 'apps', options.name + '.png')
var iconFile
if (resolution === 'scalable') {
iconFile = path.join(dir, 'usr/share/icons/hicolor', resolution, 'apps', options.name + '.svg')
} else {
iconFile = path.join(dir, 'usr/share/icons/hicolor', resolution, 'apps', options.name + '.png')
}
options.logger('Creating icon file at ' + iconFile)

mkdirp(path.dirname(iconFile), '0755', function (err, made) {
Expand Down
Loading

0 comments on commit c7ca620

Please sign in to comment.