Skip to content

Commit

Permalink
Improve TouchBar button icon display
Browse files Browse the repository at this point in the history
  • Loading branch information
jhen0409 committed Jul 23, 2023
1 parent 525c033 commit 2a2c292
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions app/utils/devMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,17 +88,20 @@ export const invokeDevMethod = (name) => () => {
};

const hslShift = [0.5, 0.2, 0.8];
const icon = (name) => nativeImage.createFromNamedImage(name, hslShift);
const icon = (name, resizeOpts) => {
const image = nativeImage.createFromNamedImage(name, hslShift);
return image.resize(resizeOpts);
};

let namedImages;
const initNamedImages = () => {
if (process.platform !== 'darwin' || namedImages) return;
namedImages = {
reload: icon('NSTouchBarRefreshTemplate'),
toggleElementInspector: icon('NSTouchBarQuickLookTemplate'),
networkInspect: icon('NSTouchBarRecordStartTemplate'),
prev: icon('NSTouchBarGoBackTemplate'),
next: icon('NSTouchBarGoForwardTemplate'),
reload: icon('NSTouchBarRefreshTemplate', { height: 20 }),
toggleElementInspector: icon('NSTouchBarQuickLookTemplate', { height: 18 }),
networkInspect: icon('NSTouchBarRecordStartTemplate', { height: 20 }),
prev: icon('NSTouchBarGoBackTemplate', { height: 20 }),
next: icon('NSTouchBarGoForwardTemplate', { height: 20 }),
};
};

Expand Down

0 comments on commit 2a2c292

Please sign in to comment.