[英]Finder toolbar icons are jagged or anti-aliased on non-retina displays
I'm trying to create Finder toolbar icons that match the look and feel of Monterey, but they seem to be jagged as if there are issues with anti-aliasing.我正在尝试创建与 Monterey 的外观和感觉相匹配的 Finder 工具栏图标,但它们似乎参差不齐,好像存在抗锯齿问题。
Here are the retina icons I'm trying to convert (two on the right):这是我要转换的视网膜图标(右边两个):
And here is how they look on my non-retina display:这是他们在我的非视网膜显示器上的样子:
At first, I thought this was simply a problem with automatic anti-aliasing.起初,我以为这只是自动抗锯齿的问题。 However, when I manually resize the icons to 32x32, this is how they're supposed to look:
但是,当我手动将图标调整为 32x32 时,它们应该是这样的:
But when I use those icons in Finder, they look jagged all over again.但是当我在 Finder 中使用这些图标时,它们看起来又是锯齿状的。 I have no idea what is happening.
我不知道发生了什么。
Update更新
Steps to reproduce:重现步骤:
icon_terminal_light.icns
from this icon packicon_terminal_light.icns
icon_terminal_light.icns
onto the icon in the upper-lefticon_terminal_light.icns
到左上角的图标上Notice:注意:
If you move the Finder toolbar to a non-retina screen, the icon will look thin and the edges will be jagged.如果将 Finder 工具栏移动到非 Retina 屏幕上,图标看起来会变细并且边缘会出现锯齿状。
You can even open icon_terminal_light.icns
in Preview, resize it to 32x32, and then export it to a new icns file.您甚至可以在预览中打开
icon_terminal_light.icns
,将其调整为 32x32,然后将其导出到新的 icns 文件。 The icns file will look smooth on a non-retina monitor, but if you try putting it into the toolbar, it'll be jagged once again. icns 文件在非 Retina 显示器上看起来很平滑,但如果您尝试将它放入工具栏,它会再次出现锯齿状。
Finder has a quirk whereby the alpha layers of toolbar icons get multiplied by two when the window is active. Finder 有一个怪癖,当 window 处于活动状态时,工具栏图标的 alpha 层会乘以二。 If the Finder window is in the background, however, the icons probably look how'd you expect.
但是,如果 Finder window 在后台,图标可能看起来像您期望的那样。
If your icons have any thin graphical element, the anti-aliased pixels will have low alpha values.如果您的图标有任何细图形元素,抗锯齿像素将具有低 alpha 值。 When those alpha values are doubled, the pixels practically disappear, which is what looks like is happening.
当这些 alpha 值加倍时,像素几乎消失了,这看起来像是正在发生的事情。
I solved this issue when trying to resize the icons provided in OpenInTerminal-Light .我在尝试调整OpenInTerminal-Light中提供的图标大小时解决了这个问题。 My solution is a bit of a hack:
我的解决方案有点骇人听闻:
To fix the rendering, I manually resized the icons and added 89% gray behind the anti-aliased pixels.
为了修复渲染,我手动调整了图标的大小并在抗锯齿像素后面添加了 89% 的灰色。 Every pixel has either 0% or 100% alpha now.
现在每个像素都具有 0% 或 100% 的 alpha。
You can see more detailed notes in the issue I opened on GitHub .你可以在我在 GitHub 上打开的问题中看到更详细的注释。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.