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: generate icons as 16×16 #2837

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions src/core/generator/fileGenerator.ts
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not super happy with the fact that the file icon is not aligned in the middle. Typically - if possible - we try to have one pixel above and one below and try to center the rest of the icon in the remaining 14 pixels. Additionally, the edge on the top right looks a little too thick. Do you think we can improve this a little bit? I'm also open for a new file design, but it should look good and not just fulfill some pixel perfext guidelines. Fulfilling both requirements would of course be perfect.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh? I was under the assumption that being pixel-perfect @ 16×16 was a new soft-requirement. That'll make this a loooot easier if there's some wiggle-room

Original file line number Diff line number Diff line change
Expand Up @@ -238,11 +238,11 @@ export const generateFileIcons = async (
}

const fileIcon =
'M13 9h5.5L13 3.5V9M6 2h8l6 6v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4c0-1.11.89-2 2-2m5 2H6v16h12v-9h-7V4z';
'M9 3v3h3Zm4 2v9q0 1-1 1H4q-1 0-1-1V3q0-1 1-1h6ZM8 3H4v11h8V7H8Z';

await writeSVGFiles(
'file',
getSVG(getPath(fileIcon, color), 24),
getSVG(getPath(fileIcon, color)),
opacity,
saturation
);
Expand Down
14 changes: 6 additions & 8 deletions src/core/generator/folderGenerator.ts
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could make out some differences between the normal folder icon and some specific folder icons (in this case the folder-dist icon). Then I put both of them together and found out that there's a different design. I'd highly appreciate if we could use the same folder shape for the default and the specific folder icons:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with them being synced, but I'm not certain if that uniformity is actually enforced atm. It'd be nice if there was some way to explicitly sync these icons, but that might be outside the scope of this PR. I'll still look into it later today

Original file line number Diff line number Diff line change
Expand Up @@ -450,9 +450,9 @@ export const generateFolderIcons = async (
}

const folderIcon =
'M13.84376,7.53645l-1.28749-1.0729A2,2,0,0,0,11.27591,6H4A2,2,0,0,0,2,8V24a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2H15.12412A2,2,0,0,1,13.84376,7.53645Z';
'M2 13q-1 0-1-1V4q0-1 1-1h3c1 0 1 1 2 1h7q1 0 1 1v7q0 1-1 1Z';
const folderIconOpen =
'M28.96692,12H9.44152a2,2,0,0,0-1.89737,1.36754L4,24V10H28a2,2,0,0,0-2-2H15.1241a2,2,0,0,1-1.28038-.46357L12.5563,6.46357A2,2,0,0,0,11.27592,6H4A2,2,0,0,0,2,8V24a2,2,0,0,0,2,2H26l4.80523-11.21213A2,2,0,0,0,28.96692,12Z';
'M2 13q-1 0-1-1V4q0-1 1-1h3c1 0 1 1 2 1h6q1 0 1 1H2v7l2-5q.4-1 1-1h9q1.8 0 1 2l-2 5Z';

await writeSVGFiles(
'folder',
Expand Down Expand Up @@ -484,20 +484,18 @@ export const generateRootFolderIcons = async (
return logger.error('Invalid color code for root folder icons');
}

const rootFolderIcon =
'M16,5A11,11,0,1,1,5,16,11.01245,11.01245,0,0,1,16,5m0-3A14,14,0,1,0,30,16,14,14,0,0,0,16,2Zm0,8a6,6,0,1,0,6,6A6,6,0,0,0,16,10Z';
const rootFolderIconOpen =
'M16,5A11,11,0,1,1,5,16,11.01245,11.01245,0,0,1,16,5m0-3A14,14,0,1,0,30,16,14,14,0,0,0,16,2Z';
const rootFolderIconOuter = `<circle cx="8" cy="8" r="6" fill="none" stroke="${color}" stroke-width="2"/>`;
PKief marked this conversation as resolved.
Show resolved Hide resolved
const rootFolderIconInner = `<circle cx="8" cy="8" r="3" fill="${color}"/>`;

await writeSVGFiles(
'folder-root',
getSVG(getPath(rootFolderIcon, color)),
getSVG(rootFolderIconOuter + rootFolderIconInner),
opacity,
saturation
);
await writeSVGFiles(
'folder-root-open',
getSVG(getPath(rootFolderIconOpen, color)),
getSVG(rootFolderIconOuter),
opacity,
saturation
);
Expand Down
2 changes: 1 addition & 1 deletion src/core/generator/shared/svg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ export const writeSVGFiles = async (
export const getPath = (d: string, color: string) =>
`<path d="${d}" fill="${color}" />`;

export const getSVG = (path: string, viewBoxSize = 32) =>
export const getSVG = (path: string, viewBoxSize = 16) =>
`<svg viewBox="0 0 ${viewBoxSize} ${viewBoxSize}" xmlns="http://www.w3.org/2000/svg">${path}</svg>`;
Loading