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

Pixel perfect icons at 16px #2226

Merged
merged 5 commits into from Feb 19, 2024
Merged

Conversation

lucas-labs
Copy link
Contributor

@lucas-labs lucas-labs commented Feb 18, 2024

This PR implements changes to approximately 240 file icons and all (~150) folder icons to enhance their appearance at 16x16 px, aligning with the default size of icons in VS Code.

The changes encompass various adjustments aimed at improving clarity, sharpness, and overall visual appeal when viewed at this smaller scale.

Additionally, it includes a new section in the CONTRIBUTING.md guide offering a few tips and tricks for designing pixel-perfect icons.

closes: #2225
closes: #1310

makes around 240 file icons and all folder icons
to look sharper at 16px, which is the default
size of file icons in vscode
changes the svg paths of the generated icons
(default folder, root folder and file) to look
sharper at 16px
Copy link

Preview

Thank you for creating a pull request. This preview shows you how your changes will look on the different themes:

Generated Preview

You can find more information how to contribute in the contribution guidelines.

@lucas-labs
Copy link
Contributor Author

That was a large preview, mr github actions 😂

Copy link

Preview

Thank you for creating a pull request. This preview shows you how your changes will look on the different themes:

Generated Preview

You can find more information how to contribute in the contribution guidelines.

Copy link

Preview

Thank you for creating a pull request. This preview shows you how your changes will look on the different themes:

Generated Preview

You can find more information how to contribute in the contribution guidelines.

Copy link
Owner

@PKief PKief left a comment

Choose a reason for hiding this comment

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

Thank you for the changes, it looks super good. I'm very thankful for it! ❤️

Even the updated contributing.md file looks very good and is super informative for future contributions.

@PKief PKief merged commit c4416fa into PKief:main Feb 19, 2024
3 of 4 checks passed
Copy link

Merge Successful

Thanks for your contribution! 🎉

The changes will be part of the upcoming update on the marketplace.

@geekley
Copy link

geekley commented Mar 4, 2024

Why does the preview not show a light theme icon for npm? 🤔

@lucas-labs
Copy link
Contributor Author

Why does the preview not show a light theme icon for npm? 🤔

Good question, didn't notice until now 😅

This was ported from a clone of this project that I use with my own additions and I switch between light and dark pretty often. I'm pretty sure the icon was working there (in vscode).

Will look into it later to see if there's an issue with the icon itself or with the action that creates the preview image.

Thanks for noticing!

@geekley
Copy link

geekley commented Mar 5, 2024

the action that creates the preview image.

On that note, the preview image seems to be made using 24px, isn't it? So it's probably better to use this opportunity to change it to 16px too. It's making the icons seem less crisp than they are.

@PKief
Copy link
Owner

PKief commented Mar 5, 2024

the action that creates the preview image.

On that note, the preview image seems to be made using 24px, isn't it? So it's probably better to use this opportunity to change it to 16px too. It's making the icons seem less crisp than they are.

Good point, I'll change it to 16px and see how it looks like.

@lucas-labs
Copy link
Contributor Author

Good point, I'll change it to 16px and see how it looks like.

If 16px is too small to be able to easily preview the icons, then 32px might be another option. A 16px pixel perfect icon would look crisp at 32px aswell (or any other multiple of 16, obviously).

@PKief
Copy link
Owner

PKief commented Mar 18, 2024

the action that creates the preview image.

On that note, the preview image seems to be made using 24px, isn't it? So it's probably better to use this opportunity to change it to 16px too. It's making the icons seem less crisp than they are.

I just had a look, and it seems like I've alread configured 16px for it. See the background-size property in this line:

https://github.com/PKief/svg-icon-review/blob/c5a8bc32564347628af9006a171e9e8a9fadd795/src/core/styles.ts#L11

@lucas-labs
Copy link
Contributor Author

the action that creates the preview image.

On that note, the preview image seems to be made using 24px, isn't it? So it's probably better to use this opportunity to change it to 16px too. It's making the icons seem less crisp than they are.

I just had a look, and it seems like I've alread configured 16px for it. See the background-size property in this line:

https://github.com/PKief/svg-icon-review/blob/c5a8bc32564347628af9006a171e9e8a9fadd795/src/core/styles.ts#L11

Hi @PKief, I just took a look at it, I think the scaling is happening in this line:

https://github.com/PKief/svg-icon-review/blob/c5a8bc32564347628af9006a171e9e8a9fadd795/src/core/utils/screenshot.ts#L16

await page.setViewport({ width: 800, height: 800, deviceScaleFactor: 1.5 });

The icons are generated at 16px via css, but then the entire image is being scaled 150%, which results in 24px icons

@PKief
Copy link
Owner

PKief commented Mar 20, 2024

@lucas-labs thanks for pointing that out. So if I'm not wrong it would be fine by just changing the deviceScaleFactor to 2, right? Then it's 16px * 2 = 32px. I'll try that out and see how it looks like.

@lucas-labs
Copy link
Contributor Author

@PKief yes, that should do the trick, although I don't know how puppeteer does the scaling internally... If you see there's still blurriness after the change, then setting the scale to 1 and the css property itself to 32px should work.

@PKief
Copy link
Owner

PKief commented Mar 20, 2024

@lucas-labs, @geekley I've updated the icon preview now, so that the icon is rendered with 32px.

here's for example a new image

image

(reference #2176 (comment))

Thanks for your feedback on this so far!

Please let me know if there's anything else which can be improved here.

@geekley
Copy link

geekley commented Mar 21, 2024

If 16px is too small to be able to easily preview the icons, then 32px might be another option. A 16px pixel perfect icon would look crisp at 32px aswell (or any other multiple of 16, obviously).

True, but I think it kinda defeats the purpose...?
I assumed the purpose of the preview in PRs is to easily catch an icon that might NOT look crisp at 16px, that went unnoticed - and those could still look crisp at 32px, but the editor will use 16px by default.

That's why IMO it's better to show it exactly how it'll be in the editor (for most people who won't be zooming in). Unless the purpose of the preview is something else, of course.

@PKief
Copy link
Owner

PKief commented Mar 29, 2024

If 16px is too small to be able to easily preview the icons, then 32px might be another option. A 16px pixel perfect icon would look crisp at 32px aswell (or any other multiple of 16, obviously).

True, but I think it kinda defeats the purpose...? I assumed the purpose of the preview in PRs is to easily catch an icon that might NOT look crisp at 16px, that went unnoticed - and those could still look crisp at 32px, but the editor will use 16px by default.

That's why IMO it's better to show it exactly how it'll be in the editor (for most people who won't be zooming in). Unless the purpose of the preview is something else, of course.

you're right, too. This is why I decided to show both versions now:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pixel Perfect Icons at 16px Icons are not pixel-perfect at 16px (default zoom in vscode)
3 participants